]> git.karo-electronics.de Git - karo-tx-linux.git/commit
UBI: limit amount of reserved eraseblocks for bad PEB handling
authorShmulik Ladkani <shmulik.ladkani@gmail.com>
Wed, 4 Jul 2012 08:06:01 +0000 (11:06 +0300)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 15 Aug 2012 13:54:37 +0000 (16:54 +0300)
commitbaa09d8b3bbb0611e890901e878f04f0b9721d72
tree1bd07a84f9ad9ded56cee25391657dc0e79ae3a2
parent698a3a8cfb95be2caf2703c29c590cd7b6229676
UBI: limit amount of reserved eraseblocks for bad PEB handling

The existing mechanism of reserving PEBs for bad PEB handling has two
flaws:
- It is calculated as a percentage of good PEBs instead of total PEBs.
- There's no limit on the amount of PEBs UBI reserves for future bad
  eraseblock handling.

This patch changes the mechanism to overcome these flaws.

The desired level of PEBs reserved for bad PEB handling (beb_rsvd_level)
is set to the maximum expected bad eraseblocks (bad_peb_limit) minus the
existing number of bad eraseblocks (bad_peb_count).

The actual amount of PEBs reserved for bad PEB handling is usually set
to the desired level (but in some circumstances may be lower than the
desired level, e.g. when attaching to a device that has too few
available PEBs to satisfy the desired level).

In the case where the device has too many bad PEBs (above the expected
limit), then the desired level, and the actual amount of PEBs reserved
are set to zero. No PEBs will be set aside for future bad eraseblock
handling - even if some PEBs are made available (e.g. by shrinking a
volume).
If another PEB goes bad, and there are available PEBs, then the
eraseblock will be marked bad (consuming one available PEB). But if
there are no available PEBs, ubi will go into readonly mode.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
drivers/mtd/ubi/misc.c
drivers/mtd/ubi/wl.c