JFFS2 corruption

David Woodhouse dwmw2 at infradead.org
Sun Feb 8 06:53:33 EST 2004

On Sun, 2004-02-08 at 12:38 +0100, Florian Schirmer wrote:
> Hi,
> > > i'm having a strange problem with a JFFS2 filesystem: I always get
> > > messages about incorrect CRC values while mounting the filesystem. What i
> > > did:
> >
> > Please set CONFIG_JFFS2_FS_DEBUG=1, then reproduce this with full
> > logging -- you'll need to do it over a serial console to make sure you
> > catch everything.
> Thanks for your suggestion. I'm a little bit further finding this problem. It 
> turns out to be a cmdset2 issue and not a jffs2 problem. I'm still digging 
> what is going on.
> What i've got so far is: jffs2_read_flash returns bogous data. In the case of 
> a bad crc the last odd byte is wrong. Looks like a byte access instead of a 
> word access. (Buswidth of the flash: 2)  If you look at this:

Interesting. That would be a problem in map_copy_from(), which is either
just memcpy_fromio() or a function provided by your map driver,
depending on whether you have CONFIG_MTD_COMPLEX_MAPPINGS enabled.

Can you check what memcpy_fromio() does directly? Try changing the
definition of map_copy_from() in include/linux/mtd/map.h or
drivers/mtd/maps/map_funcs.c or your map driver (depending on your
configuration) to copy a byte at a time, and see if that fixes it.

The '%zd' modifier is the correct way to print a size_t; the old %Z was
a gcc-ism. It's supported by the 2.6 and I thought also the current 2.4
kernels; what kernel are you using, precisely? It's a trivial patch to
add it.


More information about the linux-mtd mailing list