Skip to contentSkip to conversation

padding in mkfs.jffs2 and nandwrite

DISCUSSION Johannes Stezenbach 1 participant 2 messages Dec 14, 2005 – Dec 16, 2005 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hi,

I've prepared a jffs2 image with mkfs.jffs2 and written it to NAND flash using nandwrite (details below). When the file system is mounted r/w and written to, on future mounts the following warning appears:

	Empty flash at 0x000000f8 ends at 0x00000200

This is caused by the padding added by either mkfs.jffs2 -p512 or nandwrite -p, because this padding is 0xff, which jffs2 sees as "free space which was wasted" (when jffs2 flushes
a page to disk it pads with 0x00, so it can tell that this space was deliberately left unused).
(I think this warning will evetually go away when the block is garbage collected, but this can take a loooong time.)

To avoid this warning I would like to suggest that we either change mkfs.jffs2 and nandwrite to pad with 0x00, or add an option to both to choose the padding value.

One additional question: Why does mkfs.jffs2 -p by default pad to the end of the erase block? When whole pages are written with all 0xff, but the first N pages of an erase block contain valid nodes, jffs2 will assume that these pages are freshly erased and good to write in.
Won't this cause instable bits when written again by jffs2? (The data sheet for my flash says that there may be up to three partial page write before erase is needed, but I'm not sure if this allows to write the same byte twice.)

What I currently do to avoid the issue:

$ mkfs.jffs2 -v -e16384 -d foo -b -n -q | dd bs=512 conv=sync >foo.jffs2
$ flash_eraseall -j /dev/mtd0
$ nandwrite /dev/mtd0 foo.jffs2

Johannes

#1 lore raw
Quoted 29 lines · Johannes Stezenbach

I've prepared a jffs2 image with mkfs.jffs2 and written it to NAND flash using nandwrite (details below). When the file system is mounted r/w and written to, on future mounts the following warning appears:

	Empty flash at 0x000000f8 ends at 0x00000200

This is caused by the padding added by either mkfs.jffs2 -p512 or nandwrite -p, because this padding is 0xff, which jffs2 sees as "free space which was wasted" (when jffs2 flushes
a page to disk it pads with 0x00, so it can tell that this space was deliberately left unused).
(I think this warning will evetually go away when the block is garbage collected, but this can take a loooong time.)

To avoid this warning I would like to suggest that we either change mkfs.jffs2 and nandwrite to pad with 0x00, or add an option to both to choose the padding value.

One additional question: Why does mkfs.jffs2 -p by default pad to the end of the erase block? When whole pages are written with all 0xff, but the first N pages of an erase block contain valid nodes, jffs2 will assume that these pages are freshly erased and good to write in.
Won't this cause instable bits when written again by jffs2? (The data sheet for my flash says that there may be up to three partial page write before erase is needed, but I'm not sure if this allows to write the same byte twice.)

Quoted 5 lines

What I currently do to avoid the issue:

$ mkfs.jffs2 -v -e16384 -d foo -b -n -q | dd bs=512 conv=sync >foo.jffs2
$ flash_eraseall -j /dev/mtd0
$ nandwrite /dev/mtd0 foo.jffs2

Would someone be so kind and comment on this?

Why is padding handled differently in fs/jffs2/ and mkfs.jffs2? Is it a bug?

Greetings,
Johannes