1. 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
  2. 05 7月, 2009 2 次提交
  3. 10 6月, 2009 2 次提交
  4. 02 6月, 2009 4 次提交
    • D
      UBI: remove built-in gluebi · 518ceef0
      Dmitry Pervushin 提交于
      Remove built-in gluebi support. This is a preparation for a
      standalone glubi module support
      Signed-off-by: NDmitry Pervushin <dpervushin@embeddedalley.com>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      518ceef0
    • 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
    • A
      UBI: introduce new constants · 90bf0265
      Artem Bityutskiy 提交于
      This patch is a clean-up and a preparation for the following
      patches. It introduece constants for the return values of the
      'ubi_eba_copy_leb()' function.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      90bf0265
  5. 18 5月, 2009 3 次提交
  6. 27 1月, 2009 1 次提交
  7. 18 1月, 2009 1 次提交
  8. 16 12月, 2008 2 次提交
  9. 24 7月, 2008 5 次提交
  10. 22 4月, 2008 1 次提交
  11. 17 4月, 2008 1 次提交
  12. 04 3月, 2008 1 次提交
  13. 25 1月, 2008 5 次提交
    • A
      e653879c
    • A
      UBI: simplify internal interfaces · 1b68d0ee
      Artem Bityutskiy 提交于
      Instead of passing vol_id to all functions and then find
      struct ubi_volume, pass struct ubi_volume pointer.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      1b68d0ee
    • A
      UBI: add auto-resize feature · 4ccf8cff
      Artem Bityutskiy 提交于
      The problem: NAND flashes have different amount of initial bad physical
      eraseblocks (marked as bad by the manufacturer). For example, for 256MiB
      Samsung OneNAND flash there might be from 0 to 40 bad initial eraseblocks,
      which is about 2%. When UBI is used as the base system, one needs to know
      the exact amount of good physical eraseblocks, because this number is
      needed to create the UBI image which is put to the devices during
      production. But this number is not know, which forces us to use the
      minimum number of good physical eraseblocks. And UBI additionally
      reserves some percentage of physical eraseblocks for bad block handling
      (default is 1%), so we have 1-3% of PEBs reserved at the end, depending
      on the amount of initial bad PEBs. But it is desired to always have
      1% (or more, depending on the configuration).
      
      Solution: this patch adds an "auto-resize" flag to the volume table.
      The volume which has the "auto-resize" flag will automatically be re-sized
      (enlarged) on the first UBI initialization. UBI clears the flag when
      the volume is re-sized. Only one volume may have the "auto-resize" flag.
      
      So, the production UBI image may have one volume with "auto-resize"
      flag set, and its size is automatically adjusted on the first boot
      of the device.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      4ccf8cff
    • A
      UBI: use bit-fields · 896c0c06
      Artem Bityutskiy 提交于
      Save 12 bytes of RAM per volume by using bit-fields instead of integers.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      896c0c06
    • A
      UBI: get rid of ubi_ltree_slab · b9a06623
      Artem Bityutskiy 提交于
      This slab cache is not really needed since the number of objects
      is low and the constructor does not make much sense because we
      allocate oblects when doint I/O, which is way slower then allocation.
      Suggested-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      b9a06623
  14. 27 12月, 2007 11 次提交
    • A
      UBI: use separate mutex for volumes checking · 783b273a
      Artem Bityutskiy 提交于
      Introduce a separate mutex which serializes volumes checking,
      because we cammot really use volumes_mutex - it cases reverse
      locking problems with mtd_tbl_mutex when gluebi is used -
      thanks to lockdep.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      783b273a
    • A
      UBI: handle attach ioctl · 897a316c
      Artem Bityutskiy 提交于
      Actually implement the MTD device attach/detach handlers.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      897a316c
    • A
      UBI: remove data_offset · dd38fccf
      Artem Bityutskiy 提交于
      'data_offset' parameter does not really make sense and it is not
      needed. Get rid of it.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      dd38fccf
    • A
      UBI: prepare attach and detach functions · cdfa788a
      Artem Bityutskiy 提交于
      Prepare the attach and detach functions to by used outside of
      module initialization:
      
      * detach function checks reference count before detaching
      * it kills the background thread as well
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      cdfa788a
    • A
      UBI: add UBI devices reference counting · e73f4459
      Artem Bityutskiy 提交于
      This is one more step on the way to "removable" UBI devices. It
      adds reference counting for UBI devices. Every time a volume on
      this device is opened - the device's refcount is increased. It
      is also increased if someone is reading any sysfs file of this
      UBI device or of one of its volumes.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      e73f4459
    • A
      UBI: add UBI control device · 9f961b57
      Artem Bityutskiy 提交于
      This patch is a preparation to make UBI devices dynamic. It
      adds an UBI control device which has dynamically allocated
      major number and registers itself as "ubi_ctrl". It does not
      do anything so far. The idea is that this device will allow
      to attach/detach MTD devices from userspace.
      
      This is symilar to what the Linux device mapper has.
      
      The next things to do are:
      * Fix UBI, because it now assumes UBI devices cannot go away
      * Implement control device ioctls which will attach/detach MTD
        devices
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      9f961b57
    • A
      UBI: fix ubi_wl_flush · 593dd33c
      Artem Bityutskiy 提交于
      The flush function should finish all the pending jobs. But if
      somebody else is doing a work, this function should wait and let
      it finish.
      
      This patche uses rw semaphore for synchronization purpose - it
      just looks quite convinient.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      593dd33c
    • A
      UBI: bugfix: protect from volume removal · 43f9b25a
      Artem Bityutskiy 提交于
      When the WL worker is moving an LEB, the volume might go away
      occasionally. UBI does not handle these situations correctly.
      
      This patch introduces a new mutex which serializes wear-levelling
      worker and the the 'ubi_wl_put_peb()' function. Now, if one puts
      an LEB, and its PEB is being moved, it will wait on the mutex.
      And because we unmap all LEBs when removing volumes, this will make
      the volume remove function to wait while the LEB movement
      finishes.
      
      Below is an example of an oops which should be fixed by this patch:
      
      Pid: 9167, comm: io_paral Not tainted (2.6.24-rc5-ubi-2.6.git #2)
      EIP: 0060:[<f884a379>] EFLAGS: 00010246 CPU: 0
      EIP is at prot_tree_del+0x2a/0x63 [ubi]
      EAX: f39a90e0 EBX: 00000000 ECX: 00000000 EDX: 00000134
      ESI: f39a90e0 EDI: f39a90e0 EBP: f2d55ddc ESP: f2d55dd4
       DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
      Process io_paral (pid: 9167, ti=f2d54000 task=f72a8030 task.ti=f2d54000)
      Stack: f39a95f8 ef6aae50 f2d55e08 f884a511 f88538e1 f884ecea 00000134 00000000
             f39a9604 f39a95f0 efea8280 00000000 f39a90e0 f2d55e40 f8847261 f8850c3c
             f884eaad 00000001 000000b9 00000134 00000172 000000b9 00000134 00000001
      Call Trace:
       [<c0105227>] show_trace_log_lvl+0x1a/0x30
       [<c01052e2>] show_stack_log_lvl+0xa5/0xca
       [<c01053d6>] show_registers+0xcf/0x21b
       [<c0105648>] die+0x126/0x224
       [<c0119a62>] do_page_fault+0x27f/0x60d
       [<c037dd62>] error_code+0x72/0x78
       [<f884a511>] ubi_wl_put_peb+0xf0/0x191 [ubi]
       [<f8847261>] ubi_eba_unmap_leb+0xaf/0xcc [ubi]
       [<f8843c21>] ubi_remove_volume+0x102/0x1e8 [ubi]
       [<f8846077>] ubi_cdev_ioctl+0x22a/0x383 [ubi]
       [<c017d768>] do_ioctl+0x68/0x71
       [<c017d7c6>] vfs_ioctl+0x55/0x271
       [<c017da15>] sys_ioctl+0x33/0x52
       [<c0104152>] sysenter_past_esp+0x5f/0xa5
       =======================
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      43f9b25a
    • A
      UBI: introduce volume refcounting · d05c77a8
      Artem Bityutskiy 提交于
      Add ref_count field to UBI volumes and remove weired "vol->removed"
      field. This way things are better understandable and we do not have
      to do whold show_attr operation under spinlock.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      d05c77a8
    • A
      UBI: tweak volumes locking · cae0a771
      Artem Bityutskiy 提交于
      Transform vtbl_mutex to volumes_mutex - this just makes code
      easier to understand.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      cae0a771
    • A
      UBI: improve internal interfaces · 89b96b69
      Artem Bityutskiy 提交于
      Pass volume description object to the EBA function which makes
      more sense, and EBA function do not have to find the volume
      description object by volume ID.
      Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
      89b96b69