1. 19 Oct, 2011 2 commits
    • Andres Salomon's avatar
      jffs2: add compr=lzo and compr=zlib options · 123005f3
      Andres Salomon authored
      ..to allow forcing of either compression scheme.  This will override
      compiled-in defaults.  jffs2_compress is reworked a bit, as the lzo/zlib
      override shares lots of code w/ the PRIORITY mode.
      
      v2: update show_options accordingly.
      Signed-off-by: default avatarAndres Salomon <dilinger@queued.net>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      123005f3
    • Andres Salomon's avatar
      jffs2: implement mount option parsing and compression overriding · 92abc475
      Andres Salomon authored
      Currently jffs2 has compile-time constants (and .config options)
      controlling whether or not the various compression/decompression
      drivers are built in and enabled.  This is fine for embedded
      systems, but it clashes with distribution kernels.  Distro kernels
      tend to turn on everything; this causes OpenFirmware to fall
      over, as it understands ZLIB-compressed inodes.  Booting a kernel
      that has LZO compression enabled, writing to the boot partition,
      and then rebooting causes OFW to fail to read the kernel from
      the filesystem.  This is because LZO compression has priority
      when writing new data to jffs2, if LZO is enabled.
      
      This patch adds mount option parsing, and a single supported
      option ("compr=none").  This adds the flexibility of being
      able to specify which compressor overrides on a per-superblock
      basis.  For now, we can simply disable compression;
      additional flexibility coming soon.
      
      v2: kill some printks, and implement show_options as suggested
      by Artem Bityutskiy.
      Signed-off-by: default avatarAndres Salomon <dilinger@queued.net>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      92abc475
  2. 16 Oct, 2011 4 commits
  3. 14 Oct, 2011 3 commits
  4. 01 Oct, 2011 1 commit
  5. 26 Sep, 2011 1 commit
  6. 23 Sep, 2011 1 commit
  7. 21 Sep, 2011 8 commits
    • Brian Norris's avatar
      mtd: nand: switch `check_pattern()' to standard `memcmp()' · 75b66d8c
      Brian Norris authored
      A portion of the `check_pattern()' function is basically a `memcmp()'.
      Since it's possible for `memcmp()' to be optimized for a particular
      architecture, we should use it instead.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      75b66d8c
    • Brian Norris's avatar
      mtd: nand: invalidate cache on unaligned reads · 6d77b9d0
      Brian Norris authored
      In rare cases, we are given an unaligned parameter `from' in
      `nand_do_read_ops()'. In such cases, we use the page cache
      (chip->buffers->databuf) as an intermediate buffer before dumping to the
      client buffer. However, there are also cases where this buffer is not
      cleanly reusable. In those cases, we need to make sure that we
      explicitly invalidate the cache.
      
      This patch prevents accidental reusage of the page cache, and for me,
      this solves some problems I come across when reading a corrupted BBT
      from flash (NAND_BBT_USE_FLASH and NAND_BBT_NO_OOB).
      
      Note: the rare "unaligned" case is a result of the extra BBT pattern +
      version located in the data area instead of OOB.
      
      Also, this patch disables caching on raw reads, since we are reading
      without error correction. This is, obviously, prone to errors and should
      not be cached.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      6d77b9d0
    • Brian Norris's avatar
      mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB set · 752ed6c5
      Brian Norris authored
      Updates to our default function for creating bad block patterns have
      broken the "no OOB" feature. The NAND_BBT_NO_OOB option should not be
      set while scanning for bad blocks, but we've been passing all BBT
      options from nand_chip.bbt_options to the bad block scan. This causes us
      to hit the:
      
      	BUG_ON(bd->options & NAND_BBT_NO_OOB);
      
      in create_bbt() when we scan the flash for bad blocks.
      
      Thus, while it can be legal to set NAND_BBT_NO_OOB in a custom badblock
      pattern descriptor (presumably with NAND_BBT_CREATE disabled?), we
      should not pass it through in our default function.
      
      Also, to help clarify and emphasize that the function creates bad block
      patterns only (not, for example, table descriptors for locating
      flash-based BBT), I renamed `nand_create_default_bbt_descr' to
      `nand_create_badblock_pattern'.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      752ed6c5
    • Brian Norris's avatar
      mtd: nand: wait to set BBT version · dadc17a3
      Brian Norris authored
      Because there are so many cases of checking, writing, and re-writing of
      the bad block table(s), we might as well wait until the we've settled on
      a valid, clean copy of the table. This also prevents us from falsely
      incrementing the table version. For example, we may have the following:
      
        Primary table, with version 0x02
        Mirror table, with version 0x01
        Primary table has uncorrectable ECC errors
      
      If we don't have this fix applied, then we will:
      
        Choose to read the primary table (higher version)
        Set mirror table version to 0x02
        Read back primary table
        Invalidate table because of ECC errors
        Retry readback operation with mirror table, now version 0x02
        Mirrored table reads cleanly
        Writeback BBT to primary table location (with "version 0x02")
      
      However, the mirrored table shouldn't have a new version number.
      Instead, we actually want:
      
        Choose to read the primary table (higher version)
        Read back primary table
        Invalidate table because of ECC errors
        Retry readback with mirror table (version 0x01)
        Mirrored table reads cleanly
        Set both tables to version 0x01
        Writeback BBT to primary table location (version 0x01)
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      dadc17a3
    • Brian Norris's avatar
      mtd: nand: scrub BBT on ECC errors · 623978de
      Brian Norris authored
      Now that `read_bbt()' returns ECC error codes properly, we handle those
      codes when checking the integrity of our flash-based BBT.
      
      The modifications can be described by this new policy:
      
      *) On any uncorrected ECC error, we invalidate the corresponding table
         and retry our version-checking integrity logic.
      *) On corrected bitflips, we mark both tables for re-writing to flash
         (a.k.a. scrubbing).
      
      Current integrity checks (i.e., comparing version numbers, etc.) should
      take care of all the cases that result in rescanning the device for bad
      blocks or falling back to the BBT as found in the mirror descriptor.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      623978de
    • Brian Norris's avatar
      mtd: nand: report ECC errors properly when reading BBT · 167a8d52
      Brian Norris authored
      Instead of just printing a warning when encountering ECC errors, we
      should return a proper error status and print a more informative
      warning. Later, we will handle these error messages in the upper layers
      of the BBT scan.
      
      Note that this patch makes our check for ECC error codes a little bit
      more restrictive, leaving all unrecognized errors to the generic "else"
      clause. This shouldn't cause problems and could even be a benefit.
      
      This code is based on some findings reported by Matthieu Castet.
      Reported-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      167a8d52
    • Brian Norris's avatar
    • Brian Norris's avatar
      mtd: define `mtd_is_*()' functions · 7387ce77
      Brian Norris authored
      These functions can be used instead of referencing -EUCLEAN and -EBADMSG
      all over the place. They should help make code a little bit more
      readable.
      Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
      Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
      7387ce77
  8. 11 Sep, 2011 20 commits