]> www.infradead.org Git - mtd-utils.git/commit
ubiattach: introduce max_beb_per1024 in UBI_IOCATT
authorRichard Genoud <richard.genoud@gmail.com>
Wed, 22 Aug 2012 16:04:36 +0000 (18:04 +0200)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thu, 23 Aug 2012 09:16:10 +0000 (12:16 +0300)
commit878e06ea555ba5dbfb974b3904d1a86a9a0e20f5
treea262182820d5025c780c23100f832e82287e7833
parent257ad252e70a7b65f11f7f006416a76e4498f3d2
ubiattach: introduce max_beb_per1024 in UBI_IOCATT

The ioctl UBI_IOCATT has been extended with max_beb_per1024 parameter.

This parameter is used for adjusting the "maximum expected number of
bad blocks per 1024 blocks" for each mtd device.
The number of physical erase blocks (PEB) that UBI will reserve for bad
block handling is now:
whole_flash_chipset__PEB_number * max_beb_per1024 / 1024

This means that for a 4096 PEB NAND device with 3 MTD partitions:
mtd0: 512 PEB
mtd1: 1536 PEB
mtd2: 2048 PEB

the commands:
ubiattach -m 0 -d 0 -b 20 /dev/ubi_ctrl
ubiattach -m 1 -d 1 -b 20 /dev/ubi_ctrl
ubiattach -m 2 -d 2 -b 20 /dev/ubi_ctrl
will attach mtdx to UBIx and reserve:
80 PEB for bad block handling on UBI0
80 PEB for bad block handling on UBI1
80 PEB for bad block handling on UBI2

=> for the whole device, 240 PEB will be reserved for bad block
handling.

This may seems a waste of space, but as far as the bad blocks can appear
every where on a flash device, in the worst case scenario they can
all appear in one MTD partition.
So the maximum number of expected erase blocks given by the NAND
manufacturer should be reserve on each MTD partition.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
tests/fs-tests/integrity/integck.c
ubi-utils/include/libubi.h
ubi-utils/libubi.c
ubi-utils/ubiattach.c