Re: [PATCH] mtd: Introduce CONFIG_MTD_RESERVE_END

Ben Shelton
2015-04-30T17:36:59Z

Hi Brian,

On 04/29, Brian Norris wrote:
> > + This can be useful if, for example, the BBT is stored at the end
> > + of the flash, and you don't want those blocks counted as part of
> > + the last MTD partition.
>
> And why is that a problem? We don't add Kconfig options just because you
> "don't want" something.

It's not a "problem" per se, but it does cause the calculated/displayed number
of bad PEBs to be greater than it actually is. In older kernel versions, this
used to cause a warning on mount that it could not reserve enough PEBs, but
this no longer occurs.

Without the patch and config setting:

UBI: attached mtd3 (name "root", size 942 MiB) to ubi1
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 7539, bad PEBs: 4, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 549/79, WL threshold: 4096, image sequence number: 0
UBI: available PEBs: 4, total reserved PEBs: 7535, PEBs reserved for bad PEB handling: 156

With the patch and config setting:

UBI: attached mtd3 (name "root", size 942 MiB) to ubi1
UBI: PEB size: 131072 bytes (128 KiB), LEB size: 129024 bytes
UBI: min./max. I/O unit sizes: 2048/2048, sub-page size 512
UBI: VID header offset: 512 (aligned 512), data offset: 2048
UBI: good PEBs: 7539, bad PEBs: 0, corrupted PEBs: 0
UBI: user volume: 1, internal volumes: 1, max. volumes count: 128
UBI: max/mean erase counter: 549/79, WL threshold: 4096, image sequence number: 0
UBI: available PEBs: 0, total reserved PEBs: 7539, PEBs reserved for bad PEB handling: 160

The reason for doing this as a Kconfig option rather than with an additional
partition is that we use the same .itb boot image (and kernel arguments) for
a series of embedded controllers that have different NAND flash sizes, and we
use the '-' command line parameter to give the root partition all the available
space after the other partitions.

Thanks,
Ben