linux-kernel-test/drivers/mtd/ubi
Richard Genoud ba4087e956 UBI: use the whole MTD device size to get bad_peb_limit
On NAND flash devices, UBI reserves some physical erase blocks (PEB) for
bad block handling. Today, the number of reserved PEB can only be set as a
percentage of the total number of PEB in each MTD partition. For example, for a
NAND flash with 128KiB PEB, 2 MTD partition of 20MiB (mtd0) and 100MiB (mtd1)
and 2% reserved PEB:
 - the UBI device on mtd0 will have 2 PEB reserved
 - the UBI device on mtd1 will have 16 PEB reserved

The problem with this behaviour is that NAND flash manufacturers give a
minimum number of valid block (NVB) during the endurance life of the
device, e.g.:

Parameter             Symbol    Min    Max    Unit      Notes
--------------------------------------------------------------
Valid block number     NVB     1004    1024   Blocks     1

From this number we can deduce the maximum number of bad PEB that a device will
contain during its endurance life: a 128MiB NAND flash (1024 PEB) will not have
less than 20 bad blocks during the flash endurance life.

But the manufacturer doesn't tell where those bad block will appear. He doesn't
say either if they will be equally disposed on the whole device (and I'm pretty
sure they won't). So, according to the datasheets, we should reserve the
maximum number of bad PEB for each UBI device (worst case scenario: 20 bad
blocks appears on the smallest MTD partition).

So this patch make UBI use the whole MTD device size to calculate the maximum
bad expected eraseblocks.

The Kconfig option is in per1024 blocks, thus it can have a default value of 20
which is *very* common for NAND devices.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-09-04 09:39:00 +03:00
..
attach.c UBI: add volume id struct ubi_ainf_peb 2012-05-21 11:34:41 +03:00
build.c UBI: use the whole MTD device size to get bad_peb_limit 2012-09-04 09:39:00 +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: use the whole MTD device size to get bad_peb_limit 2012-09-04 09:39:00 +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: kill CONFIG_MTD_UBI_BEB_RESERVE 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