[RFC] slight UBI scan time improvement

Artem Bityutskiy dedekind at infradead.org
Wed Apr 23 10:09:19 EDT 2008

On Wed, 2008-04-23 at 23:42 +1000, Hamish Moffatt wrote:
> On Wed, Apr 23, 2008 at 03:57:47PM +0300, Artem Bityutskiy wrote:
> > On Wed, 2008-04-23 at 22:40 +1000, Hamish Moffatt wrote:
> > > Well I think from past use of "time ubiattach ..." that most of
> > > the missing time is in the attach. 
> > Sure, UBI takes most of the time. Its just if you want to save 1.2+ sec,
> > you may try to play with on-flash BBT.
> I'm not sure what this means.. ? Instead of having to scan each block
> to check the marker, it has a central table? And that table is created
> once by an initial scan and then added to when UBI declares a block bad?
> How do I access this feature?

When your NAND driver is initialized, it scans whole flash and builds
the BBT. Basically, it reads OOB area of each first (and may be second)
page of each eraseblock. The BBT is simply an array with 1 bit per

You may make it save the BBT on the flash media. So next time you boot,
it reads the BBT from a pre-defined place (e.g., the last eraseblock)
and that's it. It does not scan and does not waste time.

This all is happening in the driver, before UBI starts.

Yes, if UBI marks a block bad, which basically means it calls an MTD
function, the NAND infrastructure changes the on-flash BBT.

But I never used this myself, so my knowledge is theoretical. I just
know others use this and I saw the code in nand_base.c.

Best regards,
Artem Bityutskiy (Битюцкий Артём)

More information about the linux-mtd mailing list