JFFS2 CLEANMARKER changes size when device is mounted

1k views Asked by At

At mount time JFFS2 CLEANMARKER size change from default 0x0C (12B) to 0x0200 (512B).
I saw this behaviour when I mount my test image on target hw (NOR) and file system size increased in crazy way when I copy any file to it.

Test bench
I create a file with 512kB of "aa55" only for reference and with it the JFFS2 file system uncompressed image was created (erase block 128kB page 4kB)

dd if=<(yes $'\xaa55' |tr -d "\n") of=firma_512kB.txt bs=1024 count=512
mkdir firma/
cp firma
cp firma_512kB.txt firma/
sudo mkfs.jffs2 -v -o firma_512.jffs2 -e 0x20000 -s 0x1000 -m none -d firma/

On target the image was copied to mtd14. (It was erased previously. Look that CLEANMARKER has 0x0c size)

flash_eraseall -j /dev/mtd14
  00000000  85 19 03 20 0c 00 00 00  b1 b0 1e e4 ff ff ff ff  |... ............|
  00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
  *
  ...
  000a0000  85 19 03 20 0c 00 00 00  b1 b0 1e e4 ff ff ff ff  |... ............|
  000a0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
  *
  000c0000  85 19 03 20 0c 00 00 00  b1 b0 1e e4 ff ff ff ff  |... ............|
  000c0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
  *
  ...
  *
  00860000  85 19 03 20 0c 00 00 00  b1 b0 1e e4 ff ff ff ff  |... ............|
  00860010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
  *
  00880000

Image copy to mtd15 device and inspection, shows... (It could be seen that image was copy ok and CLEANMARKER size still is 0x0c)

dd if=firma_512.jffs2 of=/dev/mtd14  
hexdump -C /dev/mtd14  
(hexdump -C /dev/mtdblock14 gives the same result)

  ....
  00081340  85 19 02 e0 44 10 00 00  6d 58 d1 84 02 00 00 00  |....D...mX......|
  00081350  84 00 00 00 a4 81 00 00  e8 03 e8 03 00 00 08 00  |................|
  00081360  a3 dc df 53 a3 dc df 53  a3 dc df 53 00 f0 07 00  |...S...S...S....|
  00081370  00 10 00 00 00 10 00 00  00 00 00 00 db 7c 54 f0  |.............|T.|
  00081380  3c 30 bd 6f aa 55 aa 55  aa 55 aa 55 aa 55 aa 55  |<0.o.U.U.U.U.U.U|
  00081390  aa 55 aa 55 aa 55 aa 55  aa 55 aa 55 aa 55 aa 55  |.U.U.U.U.U.U.U.U|
  *
  00082380  aa 55 aa 55 ff ff ff ff  ff ff ff ff ff ff ff ff  |.U.U............|
  00082390  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
  *
  000a0000  85 19 03 20 0c 00 00 00  b1 b0 1e e4 ff ff ff ff  |... ............|
  000a0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
  *
  000c0000  85 19 03 20 0c 00 00 00  b1 b0 1e e4 ff ff ff ff  |... ............|
  000c0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

And now the braindeath problem, at least for me. mount -t jffs2 /dev/mtdblock14 /mnt/app2

  dmesg
     CLEANMARKER node found at 0x00000000 has totlen 0xc != normal 0x200
     ...
     CLEANMARKER node found at 0x000c0000 has totlen 0xc != normal 0x200
     CLEANMARKER node found at 0x000e0000 has totlen 0xc != normal 0x200
     ...
     CLEANMARKER node found at 0x00860000 has totlen 0xc != normal 0x200

  hexdump -C /dev/mtd14
     ....
     00081340  85 19 02 e0 44 10 00 00  6d 58 d1 84 02 00 00 00  |....D...mX......|
     00081350  84 00 00 00 a4 81 00 00  e8 03 e8 03 00 00 08 00  |................|
     00081360  a3 dc df 53 a3 dc df 53  a3 dc df 53 00 f0 07 00  |...S...S...S....|
     00081370  00 10 00 00 00 10 00 00  00 00 00 00 db 7c 54 f0  |.............|T.|
     00081380  3c 30 bd 6f aa 55 aa 55  aa 55 aa 55 aa 55 aa 55  |<0.o.U.U.U.U.U.U|
     00081390  aa 55 aa 55 aa 55 aa 55  aa 55 aa 55 aa 55 aa 55  |.U.U.U.U.U.U.U.U|
     *
     00082380  aa 55 aa 55 ff ff ff ff  ff ff ff ff ff ff ff ff  |.U.U............|
     00082390  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
     *
     000a0000  85 19 03 20 00 02 00 00  67 db 4c ad ff ff ff ff  |... ....g.L.....|
     000a0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
     *
     000c0000  85 19 03 20 00 02 00 00  67 db 4c ad ff ff ff ff  |... ....g.L.....|
     000c0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
     *
     000e0000  85 19 03 20 00 02 00 00  67 db 4c ad ff ff ff ff  |... ....g.L.....|
     000e0010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

The CLEANMARKER size change not only make a mess but waste a lot of space in device. Why at mount time it is changed? It can be avoided?

Your advise/suggestion are welcome

Target desrciption:
Linux-2.6.31
NOR: Spansion S29GL512S (Erase Sector 128kB Page Size 4kB x16dBUS)

0

There are 0 answers