From 878e06ea555ba5dbfb974b3904d1a86a9a0e20f5 Mon Sep 17 00:00:00 2001 From: Richard Genoud Date: Wed, 22 Aug 2012 18:04:36 +0200 Subject: 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 Signed-off-by: Artem Bityutskiy --- tests/fs-tests/integrity/integck.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c index 30322cd..f12dfac 100644 --- a/tests/fs-tests/integrity/integck.c +++ b/tests/fs-tests/integrity/integck.c @@ -3152,6 +3152,7 @@ static int reattach(void) req.mtd_num = args.mtdn; req.vid_hdr_offset = 0; req.mtd_dev_node = NULL; + req.max_beb_per1024 = 0; err = ubi_attach(libubi, "/dev/ubi_ctrl", &req); if (err) -- cgit v1.2.3