# 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.

$Id: jffs2-eraseblocks.html,v 1.1.1.1 2003/11/25 22:15:12 jharrell Exp $