JFFS2

JFFS2 provides a filesystem directly on the flash, rather than emulating a block device. For more information, see the JFFS2 PDF.


JFFS2 erase block size

Unlike the original JFFS, JFFS2 treats each erase block of the flash separately. It will never write nodes which cross from one erase block to another, and will not cope if it encounters a file system with such nodes. Any node which crosses an erase block boundary will be ignored by JFFS2, and the data it contains will be lost, causing the file system to be corrupted.

If there's not enough space at the end of the current erase block to write a whole node, JFFS2 will leave it blank and continue writing to a new erase block.

Also, JFFS2 always starts writing at the beginning of an erase block, and does not expect to find free space in the middle. Any free space in an erase block should go all the way to the end of the erase block. JFFS2 will print a complaint such as:

jffs2_scan_empty(): Empty block at 0x0012fffc ends at 0x00130000 (with 0xe0021985)! Marking dirty

if it finds free space in between the nodes in an erase block. This situation is harmless though - it's just a little bit of wasted space, that's all.

Both of these situations can occur if you create a JFFS2 image with mkfs.jffs2 using the wrong value for the erase block size (the -e option). The default is 64KiB, because that's the smallest erase block size you're likely to encounter often, and creating an image with smaller eraseblock size than the actual hardware is harmless -- it just gives annoying messages. If you see the messages mentioned above, check the erase block size of your device (look in /proc/mtd if you don't know), and create your JFFS2 image for it with the correct -e option.


Erase Block Summary (EBS)

The goal of EBS is to speed up the mount process. It stores summary information at the end of every erase block. At mount time it is no longer necessary to scan all nodes individually (and read all pages of the erase blocks), enough to read this "small" summary.

This summary information is stored in a JFFS2_FEATURE_RWCOMPAT_DELETE node. During mount process if there is no summary node at the end of an erase block, the original scan process will be executed.

This node is generated automatically if EBS enabled for written data, but you should also use the user space tool called sumtool to insert summary information after you created a JFFS2 image with mkfs.jffs2. Example:

mkfs.jffs2 -rdir -oout.jffs2 -e128KiB
sumtool -iout.jffs2 -oout-sum.jffs2 -e128KiB

EBS should work with NOR and NAND, too. The rate of speedup is generally higher on NAND chips and on the chips where the erase block size is large.

Valid XHTML 1.0! Valid CSS!