diff options
| author | Richard Genoud <richard.genoud@gmail.com> | 2012-08-20 12:00:15 -0400 |
|---|---|---|
| committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-09-04 02:39:01 -0400 |
| commit | db7e21c21f293d52f5363fe8d9ee91d6bd0a503a (patch) | |
| tree | 8d2ac3f6988dabc4cd418f3ff08385972204a753 /include | |
| parent | edac493dfb48fe46d43fe6afabb8cfb2d1d4c048 (diff) | |
UBI: add max_beb_per1024 to attach ioctl
This patch provides a possibility to set the "maximum expected number of
bad blocks per 1024 blocks" (max_beb_per1024) for each mtd device using
the UBI_IOCATT ioctl.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/mtd/ubi-user.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/mtd/ubi-user.h b/include/mtd/ubi-user.h index 8787349fbafe..53cae1e11e57 100644 --- a/include/mtd/ubi-user.h +++ b/include/mtd/ubi-user.h | |||
| @@ -222,6 +222,7 @@ enum { | |||
| 222 | * @ubi_num: UBI device number to create | 222 | * @ubi_num: UBI device number to create |
| 223 | * @mtd_num: MTD device number to attach | 223 | * @mtd_num: MTD device number to attach |
| 224 | * @vid_hdr_offset: VID header offset (use defaults if %0) | 224 | * @vid_hdr_offset: VID header offset (use defaults if %0) |
| 225 | * @max_beb_per1024: maximum expected number of bad PEB per 1024 PEBs | ||
| 225 | * @padding: reserved for future, not used, has to be zeroed | 226 | * @padding: reserved for future, not used, has to be zeroed |
| 226 | * | 227 | * |
| 227 | * This data structure is used to specify MTD device UBI has to attach and the | 228 | * This data structure is used to specify MTD device UBI has to attach and the |
| @@ -245,12 +246,25 @@ enum { | |||
| 245 | * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes | 246 | * be 2KiB-64 bytes = 1984. Note, that this position is not even 512-bytes |
| 246 | * aligned, which is OK, as UBI is clever enough to realize this is 4th | 247 | * aligned, which is OK, as UBI is clever enough to realize this is 4th |
| 247 | * sub-page of the first page and add needed padding. | 248 | * sub-page of the first page and add needed padding. |
| 249 | * | ||
| 250 | * The @max_beb_per1024 is the maximum amount of bad PEBs UBI expects on the | ||
| 251 | * UBI device per 1024 eraseblocks. This value is often given in an other form | ||
| 252 | * in the NAND datasheet (min NVB i.e. minimal number of valid blocks). The | ||
| 253 | * maximum expected bad eraseblocks per 1024 is then: | ||
| 254 | * 1024 * (1 - MinNVB / MaxNVB) | ||
| 255 | * Which gives 20 for most NAND devices. This limit is used in order to derive | ||
| 256 | * amount of eraseblock UBI reserves for handling new bad blocks. If the device | ||
| 257 | * has more bad eraseblocks than this limit, UBI does not reserve any physical | ||
| 258 | * eraseblocks for new bad eraseblocks, but attempts to use available | ||
| 259 | * eraseblocks (if any). The accepted range is 0-768. If 0 is given, the | ||
| 260 | * default kernel value of %CONFIG_MTD_UBI_BEB_LIMIT will be used. | ||
| 248 | */ | 261 | */ |
| 249 | struct ubi_attach_req { | 262 | struct ubi_attach_req { |
| 250 | __s32 ubi_num; | 263 | __s32 ubi_num; |
| 251 | __s32 mtd_num; | 264 | __s32 mtd_num; |
| 252 | __s32 vid_hdr_offset; | 265 | __s32 vid_hdr_offset; |
| 253 | __s8 padding[12]; | 266 | __s16 max_beb_per1024; |
| 267 | __s8 padding[10]; | ||
| 254 | }; | 268 | }; |
| 255 | 269 | ||
| 256 | /** | 270 | /** |
