1. 30 1月, 2011 1 次提交
  2. 06 1月, 2011 1 次提交
  3. 19 10月, 2010 2 次提交
    • A
      UBI: preserve corrupted PEBs · 5fc01ab6
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      5fc01ab6
    • A
      UBI: fix small 80 characters limit style issue · c174a08c
      Artem Bityutskiy 提交于
      One line was longer than 80 lines, make it shorter.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      c174a08c
  4. 02 8月, 2010 1 次提交
    • A
      UBI: do not warn unnecessarily · 64d4b4c9
      Artem Bityutskiy 提交于
      Currently, when UBI attaches an MTD device and cannot reserve all 1% (by
      default) of PEBs for bad eraseblocks handling, it prints a warning. However,
      Matthew L. Creech <mlcreech@gmail.com> is not very happy to see this warning,
      because he did reserve enough of PEB at the beginning, but with time some
      PEBs became bad. The warning is not necessary in this case.
      
      This patch makes UBI print the warning
       o if this is a new image
       o of this is used image and the amount of reserved PEBs is only 10% (or less)
         of the size of the reserved PEB pool.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      64d4b4c9
  5. 06 5月, 2010 1 次提交
    • M
      UBI: init even if MTD device cannot be attached, if built into kernel · af7ad7a0
      Marc Kleine-Budde 提交于
      UBI can be built into the kernel or be compiled as a kernel module.
      Further on the command line one can specify MTD devices to be attach to
      UBI while loading. In the current implementation the UBI driver refuses
      to load if one of the MTD devices cannot be attached.
      
      Consider:
      1) UBI compiled into the kernel and
      2) a MTD device specified on the command line and
      3) this MTD device contains bogus data (for whatever reason).
      
      During init UBI tries to attach the MTD device is this fails the whole
      UBI subsystem isn't initialized. Later the userspace cannot attach any
      MTD to UBI because UBI isn't loaded.
      
      This patch keeps the current behaviour: if UBI is compiled as a module
      and a MTD device cannot be attached the UBI module cannot be loaded,
      but changes it for the UBI-is-built-into-the-kernel usecase.
      
      If UBI is builtin, a not attachable MTD device doen't stop UBI from
      initializing. This slightly modifies the behaviour if multiple MTD
      devices are specified on the command line. Now every MTD device is
      probed and, if possible, attached, i.e. a faulty MTD device doesn't
      stop the others from being attached.
      
      Artem: tweaked the patch
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      af7ad7a0
  6. 03 5月, 2010 1 次提交
  7. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  8. 08 3月, 2010 1 次提交
  9. 01 2月, 2010 3 次提交
    • A
      UBI: fix attaching error path · 0bf1c439
      Artem Bityutskiy 提交于
      In the error path of 'ubi_attach_mtd_dev()' we have a tricky situation:
      we have to release things differently depending on at which point
      the failure happening. Namely, if @ubi->dev is not initialized, we have
      to free everything ourselves. But if it was, we should not free the @ubi
      object, because it will be freed in the 'dev_release()' function. And
      we did not get this situation right.
      
      This patch introduces additional argument to the 'uif_init()' function.
      On exit, this argument indicates whether the final 'free(ubi)' will
      happen in 'dev_release()' or not. So the caller always knows how to
      properly release the resources.
      
      Impact: all memory is now correctly released when UBI fails to attach
              an MTD device.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      0bf1c439
    • A
      UBI: support attaching by MTD character device name · f9b0080e
      Artem Bityutskiy 提交于
      This patch adds a capability to attach MTD devices by their character
      device paths. For example, one can do:
      
      $ modprobe ubi mtd=/dev/mtd0
      
      to attach /dev/mtd0.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      f9b0080e
    • A
      UBI: mark few variables as __initdata · 9e0c7ef3
      Artem Bityutskiy 提交于
      The @mtd_devs and @mtd_dev_param variables are used only during the
      initialization, and all functions that use the variables have
      the __init prefix. This means we can safely mark the variables
      as __initdata, which is a tiny optimization.
      
      Impact: tiny RAM consumption optimization when UBI is used as a kernel
              module.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      9e0c7ef3
  10. 20 10月, 2009 1 次提交
  11. 07 7月, 2009 1 次提交
    • A
      UBI: fix NOR flash recovery · ebf53f42
      Artem Bityutskiy 提交于
      This commit fixes NOR flash recovery issues observed with Spansion
      S29GL512N NOR.
      
      When NOR erases, it first fills PEBs with zeroes, then sets all bytes
      to 0xFF. Filling with zeroes starts from the end of the PEB. And when
      power is cut, this results in PEBs containing correct EC and VID headers
      but corrupted with zeros at the end. This confuses UBI and it mistakinly
      accepts these PEBs and associate them with LEBs.
      
      Fis this issue by zeroing EC and VID magics before erasing PEBs, to
      make UBI later refuse zem.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      ebf53f42
  12. 05 7月, 2009 1 次提交
  13. 10 6月, 2009 1 次提交
  14. 02 6月, 2009 2 次提交
    • D
      UBI: add notification API · 0e0ee1cc
      Dmitry Pervushin 提交于
      UBI volume notifications are intended to create the API to get clients
      notified about volume creation/deletion, renaming and re-sizing. A
      client can subscribe to these notifications using 'ubi_volume_register()'
      and cancel the subscription using 'ubi_volume_unregister()'. When UBI
      volumes change, a blocking notifier is called. Clients also can request
      "added" events on all volumes that existed before client subscribed
      to the notifications.
      
      If we use notifications instead of calling functions like 'ubi_gluebi_xxx()',
      we can make the MTD emulation layer to be more flexible: build it as a
      separate module and load/unload it on demand.
      
      [Artem: many cleanups, rework locking, add "updated" event, provide
       device/volume info in notifiers]
      Signed-off-by: NDmitry Pervushin <dpervushin@embeddedalley.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      0e0ee1cc
    • A
      UBI: do not switch to R/O mode on read errors · b86a2c56
      Artem Bityutskiy 提交于
      This patch improves UBI errors handling. ATM UBI switches to
      R/O mode when the WL worker fails to read the source PEB.
      This means that the upper layers (e.g., UBIFS) has no
      chances to unmap the erroneous PEB and fix the error.
      This patch changes this behaviour and makes UBI put PEBs
      like this into a separate RB-tree, thus preventing the
      WL worker from hitting the same read errors again and
      again.
      
      But there is a 10% limit on a maximum amount of PEBs like this.
      If there are too much of them, UBI switches to R/O mode.
      
      Additionally, this patch teaches UBI not to panic and
      switch to R/O mode if after a PEB has been copied, the
      target LEB cannot be read back. Instead, now UBI cancels
      the operation and schedules the target PEB for torturing.
      
      The error paths has been tested by ingecting errors
      into 'ubi_eba_copy_leb()'.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      b86a2c56
  15. 26 5月, 2009 1 次提交
    • A
      UBI: fix race condition · ddbd3b61
      Artem Bityutskiy 提交于
      This patch fixes a minor problem where we may fail to wake
      upe the UBI background thread. This is not fatal at all,
      it may just result at sligtly worse performace for a short
      period of time, just because the thread will be woken up
      when real I/O on the UBI starts.
      
      Anywey, the issue is the race condition between
      'ubi_attach_mtd_dev()' and 'ubi_thread()'. If we do not
      serialize them, the 'wake_up_process()' call may be done
      before 'ubi_thread()' went seep, but after it checked
      'ubi->thread_enabled'.
      
      This issue was spotted by Shin Hong <hongshin@gmail.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      ddbd3b61
  16. 18 5月, 2009 3 次提交
  17. 21 1月, 2009 2 次提交
  18. 07 1月, 2009 1 次提交
  19. 23 12月, 2008 1 次提交
  20. 10 12月, 2008 2 次提交
  21. 25 7月, 2008 1 次提交
    • A
      UBI: always start the background thread · d37e6bf6
      Artem Bityutskiy 提交于
      This fix only affects UBI debugging.
      
      If the the background thread is disabled for debugging purposes,
      start it anyway, because otherwise we see tonns of kernel debugging
      complaints like this:
      
      INFO: task ubi_bgt0d:26857 blocked for more than 120 seconds.
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      ubi_bgt0d     D dd37bf94     0 26857      2
             dd37bfcc 00000086 f8e17cea dd37bf94 00000046 00000000 00000000 f5c62430
             f5c62430 f5c62590 c2a09c80 f6cbd498 dd8e9cbc 00000296 dd37bfb0 00000296
             dd8e9cb8 dd8e9cbc dd37bfcc c0119774 00000000 00000000 c0132e89 f6961560
      Call Trace:
       [<f8e17cea>] ? ubi_thread+0x0/0x127 [ubi]
       [<c0119774>] ? complete+0x43/0x4b
       [<c0132e89>] ? kthread+0x0/0x5b
       [<f8e17cea>] ? ubi_thread+0x0/0x127 [ubi]
       [<c0132eae>] kthread+0x25/0x5b
       [<c0132e89>] ? kthread+0x0/0x5b
       [<c0104953>] kernel_thread_helper+0x7/0x14
       =======================
      
      So start it, and go sleep inside it, instead of creating it and never
      start.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      d37e6bf6
  22. 24 7月, 2008 9 次提交
  23. 23 4月, 2008 1 次提交
  24. 20 4月, 2008 1 次提交