[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Checksum handling in jffs_rewrite_data().

In jffs_rewrite_data(), is there a reason why the checksums are written to
the raw_inode _after_ the data are written?

When power is lost during the data write, this is causing jffs_scan_flash() 
to find a node with invalid checksum. Then it finds the 'dirty' area 
immediately after that node, which actually contains the start of the name 
and data for the node which was being written. Then it scans the flash 
until it finds another valid node, and marks the whole area dirty.

This isn't good because it's going to have been the largest free area on 
the flash, and we end up with zero free space.

Creating the checksum before-hand would mean we have to read in all the 
data twice, but I can't see a better option.

I'll look at cleaning up the behaviour of jffs_scan_flash() when it finds 
dirty space followed by large amounts of free space.