NAND write buffering

Bernhard Priewasser priewasser at gmail.com
Mon Dec 12 09:39:41 EST 2005


Hi,

>>> JFFS2 is claimed to be powerfail-safe. That's true as far it will 
>>> _always_ mount, nodes are CRC-protected and scanned at Mount/GC.
>>> But what about write buffering on NAND? Doesn't this break lots of 
>>> the powerfailsafe-efforts? All the data in the writebuffer will be 
>>> lost. Assuming we are updating a logfile with small data portions. 
>>> The portions accumulate in wbuf, waiting to reach c->wbuf_pagesize so 
>>> that the buffer is written to flash. Powerfail: all these small 
>>> updates can be lost. Hm...
>>
>> I think you are right. But anyway, if you call "sync" all data will be 
>> flushed. Unfortunatelly NAND can be written only by page, so the end 
>> of the wbuf will be filled a padding node. It is a little flash 
>> wasting, but the data will be written out immediatelly.

When is NAND wbuf flushed?
sync()
fsync()
fflush()?
fclose()?

Thanks,
Bernhard




More information about the linux-mtd mailing list