UBI FS mounting time

Jamie Lokier jamie at shareable.org
Wed Jul 22 05:34:55 EDT 2009


Corentin Chary wrote:
> Do you think it would be better to fix the position of the anchor
> (first 2 good peb, ideally 0 and 1), or try to get a "good" position
> using ec and pnum ?
> 
> With a fixed position at the beginning, the scan process would be easier,
> because there is no need to reset if we find the anchor after normal blocks.
> But is does not sound very "wear leveling".

You can get wear levelling of anchor blocks by using indirect anchor
blocks, where a fixed 2 blocks points to a small set of "potential"
blocks to scan at mount time - a sort of tiny journal, small enough to
scan quickly.  The bulk of data needing for mounting is stored in
those journal blocks, and the true anchor blocks in pebs 0+1 point to
the range to be scanned.

Each mount/umount cycle, one of the scanned blocks will be updated,
except every so often the true anchor blocks in pebs 0+1 will be
updated to use a new range.

That's a two-level tree.  If you make a sufficiently deep multi-level
tree using the same idea - initial small set of indirect blocks (peb
0+1 in this example) pointing to small sets of of indirect blocks
... pointing to small sets of map blocks, then you can wear level the
whole flash evenly for any number of mount/umount cycles, and still
find the mount data quickly for any flash size.

(In fact you can run a whole filesystem like that, but that's another
topic).

For additional robustness against possible clustering of bad blocks,
make the initial small set be a sparse set of pebs over the flash
address space, instead of pebs 0+1.  I'd go for maximum address line
diversity.

-- Jamie



More information about the linux-mtd mailing list