1. 21 5月, 2012 11 次提交
    • J
      UBI: modify ubi_wl_flush function to clear work queue for a lnum · 62f38455
      Joel Reardon 提交于
      This patch modifies ubi_wl_flush to force the erasure of
      particular volume id / logical eraseblock number pairs. Previous functionality
      is preserved when passing UBI_ALL for both values. The locations where ubi_wl_flush
      were called are appropriately changed: ubi_leb_erase only flushes for the
      erased LEB, and ubi_create_volume forces only flushing for its volume id.
      External code can call this new feature via the new function ubi_flush() added
      to kapi.c, which simply passes through to ubi_wl_flush().
      
      This was tested by disabling the call to do_work in ubi thread, which results
      in the work queue remaining unless explicitly called to remove. UBIFS was
      changed to call ubifs_leb_change 50 times for four different LEBs. Then the
      new function was called to clear the queue: passing wrong volume ids / lnum,
      correct ones, and finally UBI_ALL for both to ensure it was finally all
      cleard. The work queue was dumped each time and the selective removal
      of the particular LEB numbers was observed. Extra checks were enabled and
      ubifs's integck was also run. Finally, the drive was repeatedly filled and
      emptied to ensure that the queue was cleared normally.
      
      Artem: amended the patch.
      Signed-off-by: NJoel Reardon <reardonj@inf.ethz.ch>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      62f38455
    • A
      UBI: introduce UBI_ALL constant · 05a3cb7d
      Artem Bityutskiy 提交于
      Joel will use it in his 'ubi_flush()' extention to specify all eraseblocks.
      Also amend the comment for UBI_UNKNOWN - it is used beyond attaching info
      structure now.
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      05a3cb7d
    • J
      UBI: add lnum and vol_id to struct ubi_work · d36e59e6
      Joel Reardon 提交于
      This is part of a multipart patch to allow UBI to force the erasure of
      particular logical eraseblock numbers. In this patch, the volume id and LEB
      number are added to ubi_work data structure, and both are also passed as a
      parameter to schedule erase to set it appropriately. Whenever ubi_wl_put_peb
      is called, the lnum is also passed to be forwarded to schedule erase. Later,
      a new ubi_sync_lnum will be added to execute immediately all work related to
      that lnum.
      
      This was tested by outputting the vol_id and lnum during the schedule of
      erasure. The ubi thread was disabled and two ubifs drives on separate
      partitions repeated changed a small number of LEBs. The ubi module was readded,
      and all the erased LEBs, corresponding to the volumes, were added to the
      schedule erase queue.
      
      Artem: minor tweaks
      Signed-off-by: NJoel Reardon <reardonj@inf.ethz.ch>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      d36e59e6
    • J
      UBI: add volume id struct ubi_ainf_peb · 6dd3bc7e
      Joel Reardon 提交于
      This patch adds the volume id to struct ubi_ainf_peb when scanning the LEBs at
      startup. PEBs now added to the erase queue will know their original LEB number
      and volume id, if available, and will be -1 otherwise (for instance, if the VID
      header is unreadable).
      
      This was tested by creating an ubi device with 3 volumes and disabiling the
      ubi_thread's do_work functionality. The different ubi volumes were formatted
      to ubifs and had files created and erased.  The ubi modules was reloaded and
      the list of LEB's added to the erased list was outputted, confirming the
      volume ids and LEB numbers were appropriate.
      Signed-off-by: NJoel Reardon <reardonj@inf.ethz.ch>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      6dd3bc7e
    • A
      UBI: remove scan.h · 0479ab48
      Artem Bityutskiy 提交于
      This file is small and it does not make sense to have it separate from where
      everything else lives, so merge it with ubi.h.
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      0479ab48
    • A
      UBI: move and rename attach_by_scanning · 47e1ec70
      Artem Bityutskiy 提交于
      Rename the 'attach_by_scanning()' function to 'ubi_attach()' and move it to
      scan.c. Richard will plug his fastmap stuff there.
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      47e1ec70
    • A
      UBI: rename _init_scan functions · 41e0cd9d
      Artem Bityutskiy 提交于
      We have a couple of initialization funcntionsn left which have "_scan" suffic -
      rename them:
      
      ubi_eba_init_scan() -> ubi_eba_init()
      ubi_wl_init_scan() -> ubi_wl_init()
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      41e0cd9d
    • A
      UBI: rename si to ai · a4e6042f
      Artem Bityutskiy 提交于
      After re-naming the 'struct ubi_scan_info' we should adjust all variables
      named 'si' to something else, because 'si' stands for "scanning info".
      Let's rename it to 'ai' which stands for "attaching info" which is
      a bit more consistent and has the same length, which makes re-naming easy.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
      a4e6042f
    • A
      UBI: rename struct ubi_scan_info · afc15a81
      Artem Bityutskiy 提交于
      Rename 'struct ubi_scan_info' to 'struct ubi_attach_info'. This is part
      of the code re-structuring I am trying to do in order to add fastmap
      in a more logical way. Fastmap can share a lot with scanning, including
      the attach-time data structures, which all now have "scan" word in the
      name. Let's get rid of this word.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
      afc15a81
    • R
      UBI: Kill data type hint · b36a261e
      Richard Weinberger 提交于
      We do not need this feature and to our shame it even was not working
      and there was a bug found very recently.
      	-- Artem Bityutskiy
      
      Without the data type hint UBI2 (fastmap) will be easier to implement.
      Signed-off-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      b36a261e
    • A
      UBI: always dump the stack on error · 25886a36
      Artem Bityutskiy 提交于
      UBI (and UBIFS) are a bit over-engineered WRT debugging. The idea was to
      link as few as possible when debugging is disabled, but the downside is
      that most people produce bug reports which are difficult to understand.
      
      This patch weeds out the 'ubi_dbg_dump_stack()' function and turns it
      into 'dump_stack()' - it is always useful to have stack dump in case of
      an error.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
      25886a36
  2. 09 3月, 2012 3 次提交
  3. 30 11月, 2011 1 次提交
  4. 01 6月, 2011 3 次提交
  5. 14 4月, 2011 1 次提交
  6. 16 3月, 2011 2 次提交
    • A
      UBI: kill debugging buffer · 6edb9793
      Artem Bityutskiy 提交于
      This patch kills the 'ubi->dbg_peb_buf' debugging buffer and the
      associated mutex, because all users of this buffer are now gone.
      We are killing this buffer because we are going to switch to
      dynamic debugging control, just like in UBIFS, which means that
      CONFIG_MTD_UBI_DEBUG_PARANOID will be removed. In this case we'd
      end up always allocating 'ubi->dbg_peb_buf', which is rather large
      (128KiB or more), and this would be wasteful. Thus, we are just
      killing it.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      6edb9793
    • A
      UBI: allocate write checking buffer on demand · a7586743
      Artem Bityutskiy 提交于
      Instead of using pre-allocated 'ubi->dbg_peb_buf' buffer in
      'ubi_dbg_check_write()', dynamically allocate it when needed. The
      intend is to get rid of the pre-allocated 'ubi->dbg_peb_buf' buffer
      completely. And the need for this arises because we want to change
      to dynamic debugging control instead of compile-time control, i.e.,
      we are going to kill the CONFIG_MTD_UBI_DEBUG_PARANOID Kconfig
      option, which would mean that 'ubi->dbg_peb_buf' is always allocated,
      which would be wasteful.
      
      Thus, we are getting rid of 'ubi->dbg_peb_buf', and this is a
      preparation for that.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      a7586743
  7. 08 3月, 2011 1 次提交
  8. 19 10月, 2010 5 次提交
    • 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: make check_pattern function non-static · bb00e180
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      bb00e180
    • A
      UBI: handle bit-flips when no header found · 92e1a7d9
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      92e1a7d9
    • A
      UBI: remove duplicate IO error codes · 74d82d26
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      74d82d26
    • A
      UBI: rename IO error code · 756e1df1
      Artem Bityutskiy 提交于
      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: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      756e1df1
  9. 04 6月, 2010 2 次提交
  10. 03 5月, 2010 1 次提交
  11. 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
  12. 21 9月, 2009 1 次提交
  13. 15 8月, 2009 1 次提交
  14. 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
  15. 05 7月, 2009 2 次提交
  16. 10 6月, 2009 2 次提交
  17. 02 6月, 2009 2 次提交