JFFS2 on NAND and when is file on media?

David Woodhouse dwmw2 at infradead.org
Tue May 18 18:58:25 EDT 2010


On Mon, 2010-02-15 at 13:34 +0100, Joakim Tjernlund wrote:
> Ping? Pretty please :)
> 
> Joakim Tjernlund/Transmode wrote on 2010/02/09 18:54:39:
> > 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?
> > Is the the whole file safe once close(2) returns? If not, what do
> > I have to do flush all outstanding data to media?
> >
> >  Jocke 

POSIX answers this. You need to fsync() before you close, if you want to
be sure the data have all hit the medium.

You _ought_ to be doing that on NOR flash too. Although JFFS2 _today_
might not do any write-behind, there's no guarantee that it won't do so
tomorrow. Or that you won't switch to ubifs/logfs/etc. There's no excuse
for writing buggy applications just because you _happen_ to know that
the file system doesn't _currently_ take certain liberties that it's
permitted to take.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse at intel.com                              Intel Corporation




More information about the linux-mtd mailing list