public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* JFFS2 on NAND and when is file on media?
@ 2010-02-09 17:54 Joakim Tjernlund
  2010-02-16  8:05 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Joakim Tjernlund @ 2010-02-09 17:54 UTC (permalink / raw)
  To: linux-mtd


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: JFFS2 on NAND and when is file on media?
       [not found] <OF8328EA8B.384612F6-ONC12576C5.0061F0C9-C12576C5.00626376@LocalDomain>
@ 2010-02-15 12:34 ` Joakim Tjernlund
  2010-05-18 22:58   ` David Woodhouse
  0 siblings, 1 reply; 4+ messages in thread
From: Joakim Tjernlund @ 2010-02-15 12:34 UTC (permalink / raw)
  Cc: linux-mtd

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: JFFS2 on NAND and when is file on media?
  2010-02-09 17:54 JFFS2 on NAND and when is file on media? Joakim Tjernlund
@ 2010-02-16  8:05 ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2010-02-16  8:05 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-mtd

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 (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: JFFS2 on NAND and when is file on media?
  2010-02-15 12:34 ` Joakim Tjernlund
@ 2010-05-18 22:58   ` David Woodhouse
  0 siblings, 0 replies; 4+ messages in thread
From: David Woodhouse @ 2010-05-18 22:58 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linux-mtd

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@intel.com                              Intel Corporation

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-18 22:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 17:54 JFFS2 on NAND and when is file on media? Joakim Tjernlund
2010-02-16  8:05 ` Artem Bityutskiy
     [not found] <OF8328EA8B.384612F6-ONC12576C5.0061F0C9-C12576C5.00626376@LocalDomain>
2010-02-15 12:34 ` Joakim Tjernlund
2010-05-18 22:58   ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox