JFFS2 eraseblock header

Artem B. Bityuckiy
2005-08-16T08:23:29Z

Ok, here is my *rough* offer about the JFFS2 eraseblock header.

What for?
~~~~~~~~~

a). Zhao Fusheng (aka Forrest) wants to implement fairer wear-levelling
in JFFS2. For this reason he needs to store the 'erasecount' for each
flash eraseblock.

b). The recent review of Ferenc Havasi's patch (aka the summary patch)
showed a JFFS2 inconsistency in how it calculates the physical
eraseblock to virtual eraseblock ratio. We want to fix this, probably by
switching to constant 1:1 mapping. Because of this, for compatibility,
we need to introduce JFFS2 versioning. Since there is no superblock in
JFFS2, we may add the version number to the eraseblock header as well.

Versioning support will anyway be useful in future.

How to implement?
~~~~~~~~~~~~~~~~~

1. Get rid of clean marker and use eraseblock header instead (the
eraseblock header will play the role of cleanmarker).
2. The length of the eraseblock header will not be constant, it may grow
with growing version.
3. As it is implemented currently, store the eraseblock header at the
beginning of the eraseblock, in OOB for NAND.
4. For NAND, we assume the eraseblock header may span several OOBs, not
only the first page's.

What's with compatibility?
~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Old JFFS2 binaries have to reject mounting new JFFS2 images (for
example, because we are going to change the phys:virt mapping to
constant 1:1, which is anyway incompatible). This is the problem in NAND
since the compatibility bits are not checked in clean marker (see
jffs2_check_nand_cleanmarker()). We may solve this problem by, for
example, changing types of dirent/inode nodes and adding INCOMPAT flag
there (yes, this is ugly workaround).

2. New JFFS2, when mounting an old JFFS2 binary, will use old algorithms
(1:M mappings, clean markers).

3. If JFFS2 finds that the version of the image is larger, it will
reject mounting the image. This will be useful in future.

Comments?

--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.