JFFS2: conflicting erase-block and flash block sizes

Ollie ollie88r at gmail.com
Wed Feb 7 13:35:20 PST 2018


I have two hardware platforms that utilize two different flash
hardware configurations resulting in one platform’s flash having a
block size of 128KiB, and the other 256KiB. I need to create a single
JFFS2 partition that is deployable on both targets. I have read that
it should not be a problem (data-loss wise) to compile the JFFS2
filesystem with an erase-block size smaller than the actual block-size
of the system's flash device. However, upon mounting the JFFS2
partition with an erase-block size of 128KiB on the target with a
flash block size of 256KiB, I get several of the the following warning

> Empty flash at 0xXXXXXXXX ends at 0xXXXXXXXX

I have read the FAQ which states that this is “generally not a
problem”, and that the message can be moved to a higher log level
“once you are sure that is it benign”.

I have also found the following post on the mailing list in which
Thomas Gleixner explains that…

> This happens due to NAND specific timed buffer flushing. JFFS2 fills
> up the write buffer to a full page boundary with 0xff and writes out
> the buffer to the chip, if you have no consecutive write within 2
> seconds. This is done to ensure, that data is written to FLASH.
> This fill looks like empty FLASH on mount. So JFFS2 is wondering why there
> is data after the “empty” FLASH. No reason to worry.


I find the FAQ answer, in combination with the above quoted post,
slightly concerning in that they address this issue with different
tones of confidence that this is truly not an issue. I have examined
the source code and tested quite a few read/write scenarios that could
potentially expose flaws in using conflicting erase-block / flash
block size configurations, and have found no reason to believe that
anything is “misbehaving” or being corrupted. However, I have some
questions I would like to ask before making a final design decision.

1) JFFS2 errors on the side of being vocal about what its doing. What
about the conditions of this “warning” message warrant it being at the
warning log level, and not the debug log level?

2) I need be able to say with 100% certainty that a JFFS2 partition
with a 128KiB erase-block size will not cause any data loss or
corruption on flash device with a block size of 256KiB. Is there any
explanation that asserts with 100% confidence that this will not be an
issue? As I said above, I have examined the code and functionality of
the JFFS2 driver and cannot find any reason to believe why it would

Thank you in advance,

More information about the linux-mtd mailing list