[PATCH] mtd: Add config option to skip scanning bad blocks in partitions
Daniel Ehrenberg
dehrenberg at google.com
Thu Jan 15 09:28:38 PST 2015
On Wed, Jan 14, 2015 at 11:19 AM, Brian Norris
<computersforpeace at gmail.com> wrote:
> On Wed, Jan 14, 2015 at 10:08:51AM -0800, Daniel Ehrenberg wrote:
>> To initialize the partitions, it takes me 3.5s with this config option
>> turned on and .2s with the config option turned off. So a large
>> proportion of the NAND startup time (not counting ubi coming up) is
>> comes from this bad block scan. It takes about 1.87s to scan over the
>> device, and I have my partitioning set up so there's an extra
>> partition covering the whole device in addition to the individual
>> partitions.
>
> Why don't you have BBT enabled? Even if it's just in-memory (not
> on-flash), you should only have to scan the entire flash once (not once
> for each partition), after which every subsequent lookup should only be
> a memory access. That'd cut your time in half already, I expect. But if
> you use the on-flash BBT (NAND_BBT_USE_FLASH), then you should only have
> to scan the flash once per flash lifetime, after which the bad block
> information will be stored in just a few pages, and should take only a
> millisecond or two to read.
>
> (There are other reasons for using on-flash BBT, but I won't detail them
> here.)
>
> I also recall the bad block scanning process will read not just the
> spare area, but actually the full 1st page. So that might cause a little
> unnecessary slowness.
>
> All in all, I think it's highly unlikely that your patch is necessary.
> There are much better ways to get you a faster boot time.
>
> Brian
Thanks for the suggestions. I'm new and I definitely want to do things
the right way, if there's a better way that doesn't need all these
modifications.
I'm using UBI, so I thought an on-device BBT is redundant and would be
ignored by UBI. Also, I couldn't figure out how I'm supposed to to
enable it--the out-of-tree driver I'm using isn't really based on
nand_base.c; correct me if I'm wrong, but it looks like that's a
requirement for using the nand_bbt code. Cutting my time in half
wouldn't be all that great since that's still almost 2 seconds of
useless work.
Where can I read about the other advantages of on-flash BBT when using
UBI? Maybe I can use this technique for other devices I'm working on
where nand_bbt could be used.
Thanks,
Dan
More information about the linux-mtd
mailing list