JFFS2 on NAND and when is file on media?

Artem Bityutskiy dedekind1 at gmail.com
Tue Feb 16 03:05:32 EST 2010


On Tue, 2010-02-09 at 18:54 +0100, Joakim Tjernlund wrote:
> I have been using JFFS2 for many years on NOR flash but never on NAND.
> I wonder if NAND has the same guaranties as NOR as to when one
> can expect file contents to be safely on media so one can pull the power
> without loss of data?

It is the same, except of the write-buffer. JFFS2 syncs it periodically
in 'write_super()'. So power cuts may lead to data losses, because the
write-buffer is lost. Please, read about the write buffer here:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writebuffer

This is about UBIFS, but it is the same concept as in JFFS2.

> Is the the whole file safe once close(2) returns?

No, because of the write-buffer.

>  If not, what do
> I have to do flush all outstanding data to media?

Use normal 'sync' or 'fsync()'. Here you can read about UBIFS, but it is
also somewhat relevant to JFFS2 and for all FSes:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list