From: "Joakim Tjernlund" <joakim.tjernlund@transmode.se>
To: "'Jörn Engel'" <joern@logfs.org>
Cc: 'David Woodhouse' <dwmw2@infradead.org>,
'Linux MTD mailing list' <linux-mtd@lists.infradead.org>
Subject: RE: [PATCH] Fix hanging close for /dev/mtd
Date: Wed, 13 Jun 2007 22:25:54 +0200 [thread overview]
Message-ID: <018401c7adf9$0b396040$0e67a8c0@Jocke> (raw)
In-Reply-To: <20070613175831.GC24502@lazybastard.org>
> -----Original Message-----
> From: Jörn Engel [mailto:joern@logfs.org]
> Sent: den 13 juni 2007 19:59
> To: Joakim Tjernlund
> Cc: Jörn Engel; Linux MTD mailing list; David Woodhouse
> Subject: Re: [PATCH] Fix hanging close for /dev/mtd
>
> On Wed, 13 June 2007 19:16:31 +0200, Joakim Tjernlund wrote:
> > >
> > > I can see two sane alternatives.
> > >
> > > /*
> > > * An MTD driver may return from mtd->write() calls
> before the data has
> > > * safely been written to the medium. Any amount of
> dirty data may be
> > > * cached by either the driver or the device. If a
> filesystem depends
> > > * on the data being safely on the medium, it has to
> explicitly call
> > > * mtd->sync().
> > > */
> > >
> > > /*
> > > * Mtd->write() and mtd->erase() methods may only return
> if the data has
> > > * been safely written to the device. Special care needs
> to be taken
> > > * for devices that support caching.
> > > */
> > >
> > > My tendency is to favor the first variant.
> >
> > Me too.
> >
> > > Block2mtd already implements
> > > it. And if we went for variant two, mtd->sync() would be
> pointless and
> > > should get removed.
> > >
> > > Now to the bug report:
> > > JFFS2 must call mtd->sync() for its various sync
> routines. If mounted
> > > with -o sync or for files opened with O_SYNC, it has to
> call that after
> > > every write. If nothing else, it is currently broken on
> block2mtd.
> >
> > Sure, but for NOR flash this sync can be a NOP, right?
>
> Actually, no. After dwmw2 explained things in irc, I finally
> understand
> the original meaning of that method. It is supposed to wait until any
> erase suspend (or program suspend) has finished. You can view erase
> suspend as a form of caching and erase as a form of writing.
Yes, I see that. Then it will enable writes/erases again.
>
> If we wanted to avoid the cost without paying in reliability, we could
> add an argument to sync(). Sync(now) would have the current
> semantics.
> Sync(five minutes ago) would require that any writes/erases
> started more
> than five minutes ago must be safe. It add quite a bit of complexity,
> though. Maybe not worth it.
Still don't get what sync will do for you in mtdchar context. All
mtd writes are synchronous and will be in flash without sync. So
what extra function does it get you on NOR flashes?
David, you are most welcome to explain this on the list also and
comment on my latest patches.
Jocke
next prev parent reply other threads:[~2007-06-13 20:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-13 9:53 [PATCH] Fix hanging close for /dev/mtd Joakim Tjernlund
2007-06-13 11:44 ` Josh Boyer
2007-06-13 11:48 ` Joakim Tjernlund
2007-06-13 11:50 ` Joakim Tjernlund
2007-06-13 11:54 ` Jörn Engel
2007-06-13 13:29 ` Joakim Tjernlund
2007-06-13 14:29 ` Jörn Engel
2007-06-13 17:16 ` Joakim Tjernlund
2007-06-13 17:58 ` Jörn Engel
2007-06-13 20:25 ` Joakim Tjernlund [this message]
2007-06-13 12:31 ` Josh Boyer
2007-06-13 13:25 ` Joakim Tjernlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='018401c7adf9$0b396040$0e67a8c0@Jocke' \
--to=joakim.tjernlund@transmode.se \
--cc=dwmw2@infradead.org \
--cc=joern@logfs.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox