JFFS2 on NAND flash

David Woodhouse dwmw2 at infradead.org
Thu Jan 31 05:22:43 EST 2002

gleixner at autronix.de said:
>  I tried jffs2 on a NAND flash. Tracking down one ugly bug in fs/jffs2/
> write.c  i got it basicly working ! Thanks to all of you, who did his
> job on that jffs2/nand stuff obviously  without having access to a
> NAND device. 

Be careful. You have nothing there to make sure that it doesn't violate the 
constraints on the number of write cycles per page. You have no ECC, you 
have no real chance of it working in the wild.

Also note that the locking in jffs2_garbage_collect_deletion_dirent() is 
broken. We need to lock the erase_completion_lock while we go through the 
list, and drop the lock when we read the nodes. 

> jffs2_flash_writev calls mtd->writev, if available else it calls
> mtd_fake_writev. The nand driver supports writev and does not check if
> the  vecs[1] entry is empty. mtd_fake_writev takes care of this. I
> suggest to do the check in jffs_write_dnode (where the wrong count
> comes  from), although i will include a check in nand.c. This problem
> did not show up due to the fact, that obviously none of the  FLASH
> drivers supports writev. (I could not find one in mtd)

All the writev stuff was put there for the benefit of NAND flash - so yes,
nobody's used it yet. This problem had come up recently in the eCos port,
but the fix hadn't yet propagated to the main tree.


More information about the linux-mtd mailing list