1. 21 Oct, 2010 1 commit
    • Artem Bityutskiy's avatar
      UBI: remember copy_flag while scanning · fb22b59b
      Artem Bityutskiy authored
      While scanning the flash we read all VID headers and store some important
      information in 'struct ubi_scan_leb'. Store also the 'copy_flag' value there
      as it is needed when comparing LEBs. We do not increase memory consumption
      because this is just one bit and we have plenty of spare bits in
      'struct ubi_scan_leb' (sizeof(struct ubi_scan_leb) is 48 both with and
      without this patch).
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      fb22b59b
  2. 19 Oct, 2010 13 commits
    • Artem Bityutskiy's avatar
      UBI: preserve corrupted PEBs · 5fc01ab6
      Artem Bityutskiy authored
      Currently UBI erases all corrupted eraseblocks, irrespectively of the nature
      of corruption: corruption due to power cuts and non-power cut corruption.
      The former case is OK, but the latter is not, because UBI may destroy
      potentially important data.
      
      With this patch, during scanning, when UBI hits a PEB with corrupted VID
      header, it checks whether this PEB contains only 0xFF data. If yes, it is
      safe to erase this PEB and it is put to the 'erase' list. If not, this may
      be important data and it is better to avoid erasing this PEB. Instead,
      UBI puts it to the corr list and moves out of the pool of available PEB.
      IOW, UBI preserves this PEB.
      
      Such corrupted PEB lessen the amount of available PEBs. So the more of them
      we accumulate, the less PEBs are available. The maximum amount of non-power
      cut corrupted PEBs is 8.
      
      This patch is a response to UBIFS problem where reporter
      (Matthew L. Creech <mlcreech@gmail.com>) observes that UBIFS index points
      to an unmapped LEB. The theory is that corresponding PEB somehow got
      corrupted and UBI wiped it. This patch (actually a series of patches)
      tries to make sure such PEBs are preserved - this would make it is easier
      to analyze the corruption.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      5fc01ab6
    • Artem Bityutskiy's avatar
      UBI: add truly corrupted PEBs to corrupted list · feeba4b8
      Artem Bityutskiy authored
      Start using the 'corr' list and add there PEBs which look truly corrupted,
      which means they have corrupted VID header and the data which follows the
      corrupted header does not contain all 0xFF bytes.
      
      At the moment, this does not change UBI functionality much because these
      PEBs will be erase when scanning finishes. But the plan is to teach UBI
      preserving them.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      feeba4b8
    • Artem Bityutskiy's avatar
      UBI: introduce debugging helper function · 31532494
      Artem Bityutskiy authored
      Introduce a helper function to print hexdump: 'ubi_dbg_print_hex_dump()'.
      It is compiled out if debugging is enabled. Will be used in the next patch.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      31532494
    • Artem Bityutskiy's avatar
      UBI: make check_pattern function non-static · bb00e180
      Artem Bityutskiy authored
      This patch turns static function 'check_pattern()' into a non-static
      'ubi_check_pattern()'. This is just a preparation for the chages which
      are coming in the next patches.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      bb00e180
    • Artem Bityutskiy's avatar
      UBI: do not put eraseblocks to the corrupted list unnecessarily · 0525dac9
      Artem Bityutskiy authored
      Currently UBI maintains 2 lists of PEBs during scanning:
      1. 'erase' list - PEBs which have no corruptions but should be erased
      2. 'corr' list - PEBs which have some corruptions and should be erased
      
      But we do not really need 2 lists for PEBs which should be erased after
      scanning is done - this is redundant. So this patch makes sure all PEBs
      which are corrupted are moved to the head of the 'erase' list. We add
      them to the head to make sure they are erased first and we get rid of
      corruption ASAP.
      
      However, we do not remove the 'corr' list and realted functions, because
      the plan is to use this list for other purposes. Namely, we plan to
      put eraseblocks with corruption which does not look like it was caused
      by unclean power cut. Then we'll preserve thes PEBs in order to avoid
      killing potentially valuable user data.
      
      This patch also amends PEBs accounting, because it was closely tight to
      the 'erase'/'corr' lists separation.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      0525dac9
    • Artem Bityutskiy's avatar
      UBI: separate out corrupted list · 3fb34124
      Artem Bityutskiy authored
      This patch introduces 'add_corrupted()' function and separates out 'corr' list
      manipulation from the common 'add_to_list()' function. This is just a
      preparation for further changes - this patch does not change functionality.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      3fb34124
    • Artem Bityutskiy's avatar
      UBI: change cascade of ifs to switch statements · b3321508
      Artem Bityutskiy authored
      This patch improves readability and simplifies scanning code by changing a
      long cascade of 'if' statements to a switch statement. This should presumably
      be a little faster as well.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      b3321508
    • Artem Bityutskiy's avatar
      UBI: rename a local variable · e0e718c2
      Artem Bityutskiy authored
      Rename local variable 'ec_corr' into 'ec_err' to make the code a little bit
      more readable. 'ec_err' is more appropriate because it sounds more like 'error
      when EC was read' and it looks more logical because we use it together with
      'err'. Just a minor nicification which should improve the rather complex
      scanning code.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      e0e718c2
    • Artem Bityutskiy's avatar
      UBI: handle bit-flips when no header found · 92e1a7d9
      Artem Bityutskiy authored
      Currently UBI has one small flaw - when we read EC or VID header, but find only
      0xFF bytes, we return UBI_IO_FF and do not report whether we had bit-flips or
      not. In case of the VID header, the scanning code adds this PEB to the free list,
      even though there were bit-flips.
      
      Imagine the following situation: we start writing VID header to a PEB and have a
      power cut, so the PEB becomes unstable. When we scan and read the PEB, we get
      a bit-flip. Currently, UBI would just ignore this and treat the PEB as free. This
      patch changes UBI behavior and now UBI will schedule this PEB for erasure.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      92e1a7d9
    • Artem Bityutskiy's avatar
      UBI: remove duplicate IO error codes · 74d82d26
      Artem Bityutskiy authored
      The 'UBI_IO_PEB_EMPTY' and 'UBI_IO_PEB_FREE' are essentially the same
      and mean that there are only 0xFF bytes instead of headers. Simplify
      UBI a little by turning them into a single 'UBI_IO_FF' error code.
      
      Also, stop maintaining commentaries in 'ubi_io_read_vid_hdr()' which are
      almost identical to commentaries in 'ubi_io_read_ec_hdr()'.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      74d82d26
    • Artem Bityutskiy's avatar
      UBI: rename IO error code · 756e1df1
      Artem Bityutskiy authored
      Rename UBI_IO_BAD_HDR_READ into UBI_IO_BAD_HDR_EBADMSG which is presumably more
      self-documenting and readable. Indeed, the '_READ' suffix does not tell much and
      even confuses, while '_EBADMSG' tells about uncorrectable ECC error, because we
      use -EBADMSG all over the place to represent ECC errors.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      756e1df1
    • Artem Bityutskiy's avatar
      UBI: fix small 80 characters limit style issue · c174a08c
      Artem Bityutskiy authored
      One line was longer than 80 lines, make it shorter.
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      c174a08c
    • H Hartley Sweeten's avatar
      UBI: cleanup and simplify Kconfig · 1dd78632
      H Hartley Sweeten authored
      Cleanup the Kconfig for UBI by using menuconfig to enable/disable the entire
      driver. Remove the dependency checks for MTD_UBI and MTD_UBI_DEBUG by
      wrapping the options in if/endif blocks and remove any redundant checks.
      Remove all default n since that is the Kconfig default. Change menu "Additional
      UBI debugging messages" into a comment to remove one menu level.
      Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
      Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      1dd78632
  3. 14 Oct, 2010 4 commits
    • Linus Torvalds's avatar
      Linux 2.6.36-rc8 · cd07202c
      Linus Torvalds authored
      cd07202c
    • Linus Torvalds's avatar
      Un-inline the core-dump helper functions · 3aa0ce82
      Linus Torvalds authored
      Tony Luck reports that the addition of the access_ok() check in commit
      0eead9ab ("Don't dump task struct in a.out core-dumps") broke the
      ia64 compile due to missing the necessary header file includes.
      
      Rather than add yet another include (<asm/unistd.h>) to make everything
      happy, just uninline the silly core dump helper functions and move the
      bodies to fs/exec.c where they make a lot more sense.
      
      dump_seek() in particular was too big to be an inline function anyway,
      and none of them are in any way performance-critical.  And we really
      don't need to mess up our include file headers more than they already
      are.
      Reported-and-tested-by: default avatarTony Luck <tony.luck@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3aa0ce82
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · ae42d8d4
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
        ehea: Fix a checksum issue on the receive path
        net: allow FEC driver to use fixed PHY support
        tg3: restore rx_dropped accounting
        b44: fix carrier detection on bind
        net: clear heap allocations for privileged ethtool actions
        NET: wimax, fix use after free
        ATM: iphase, remove sleep-inside-atomic
        ATM: mpc, fix use after free
        ATM: solos-pci, remove use after free
        net/fec: carrier off initially to avoid root mount failure
        r8169: use device model DMA API
        r8169: allocate with GFP_KERNEL flag when able to sleep
      ae42d8d4
    • Linus Torvalds's avatar
      Don't dump task struct in a.out core-dumps · 0eead9ab
      Linus Torvalds authored
      akiphie points out that a.out core-dumps have that odd task struct
      dumping that was never used and was never really a good idea (it goes
      back into the mists of history, probably the original core-dumping
      code).  Just remove it.
      
      Also do the access_ok() check on dump_write().  It probably doesn't
      matter (since normal filesystems all seem to do it anyway), but he
      points out that it's normally done by the VFS layer, so ...
      
      [ I suspect that we should possibly do "vfs_write()" instead of
        calling ->write directly.  That also does the whole fsnotify and write
        statistics thing, which may or may not be a good idea. ]
      
      And just to be anal, do this all for the x86-64 32-bit a.out emulation
      code too, even though it's not enabled (and won't currently even
      compile)
      Reported-by: default avatarakiphie <akiphie@lavabit.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0eead9ab
  4. 13 Oct, 2010 11 commits
  5. 12 Oct, 2010 11 commits