linux/drivers/mtd/ubi
Shmulik Ladkani 37f758a036 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>
2012-09-04 09:38:58 +03:00
..
attach.c UBI: add volume id struct ubi_ainf_peb 2012-05-21 11:34:41 +03:00
build.c UBI: introduce new bad PEB limit 2012-09-04 09:38:58 +03:00
cdev.c UBI: fix spelling of detach in debug output 2012-07-18 10:13:41 +03:00
debug.c UBI: correct usage of IS_ENABLED() 2012-06-27 14:22:15 +03:00
debug.h UBI: print PID in debug messages 2012-09-04 09:38:57 +03:00
eba.c UBI: add lnum and vol_id to struct ubi_work 2012-05-21 11:34:41 +03:00
gluebi.c UBI: Kill data type hint 2012-05-20 20:25:59 +03:00
io.c UBI: amend comments after all the renamings 2012-05-20 20:26:04 +03:00
kapi.c UBI: modify ubi_wl_flush function to clear work queue for a lnum 2012-05-21 11:34:41 +03:00
Kconfig UBI: introduce new bad PEB limit 2012-09-04 09:38:58 +03:00
Makefile UBI: rename scan.c to attach.c 2012-05-20 21:01:28 +03:00
misc.c UBI: limit amount of reserved eraseblocks for bad PEB handling 2012-09-04 09:38:58 +03:00
ubi-media.h UBI: add in hex the value for UBI_INTERNAL_VOL_START to comment 2012-05-20 21:30:45 +03:00
ubi.h UBI: introduce new bad PEB limit 2012-09-04 09:38:58 +03:00
upd.c UBI: modify ubi_wl_flush function to clear work queue for a lnum 2012-05-21 11:34:41 +03:00
vmt.c UBI: harmonize the update of ubi->beb_rsvd_pebs 2012-07-18 14:30:34 +03:00
vtbl.c UBI: amend comments after all the renamings 2012-05-20 20:26:04 +03:00
wl.c UBI: limit amount of reserved eraseblocks for bad PEB handling 2012-09-04 09:38:58 +03:00