From: Artem Bityutskiy <dedekind1@gmail.com>
To: Jon Povey <Jon.Povey@racelogic.co.uk>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Daniel Wagener <daniel.wagener@kernelconcepts.de>
Subject: RE: Subject: UBIFS and small dynamic files
Date: Fri, 28 Oct 2011 17:03:16 +0300 [thread overview]
Message-ID: <1319810603.31184.184.camel@sauron> (raw)
In-Reply-To: <70E876B0EA86DD4BAF101844BC814DFE0BF2402CFE@Cloud.RL.local>
[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]
On Mon, 2011-10-24 at 04:21 +0100, Jon Povey wrote:
> You need to rewrite files with safe POSIX semantics.
> It is not crash-safe to rewrite the target file directly (but many
> apps are naive and do this in an unsafe way)
>
> The right way to do it is write a new file on the same filesystem,
> fsync() it, then rename it over the target. The rename is atomic
> so after a crash you either get the old file or the new one.
>
> I had a quick google for the authoritative sequence but I couldn't
> find and can't remember it exactly. I think it might involve an fsync
> on the directory handle too if you want to be sure the new file has
> arrived on flash. This avoids syncing the entire filesystem
> or mounting it -o sync.
You can set per-file "sync" attribute as well.
Someone can also implement something similar as ext4 has in UBIFS: we
can sync when the last reference to the file descriptor is dropped. I
also described this in the MTD web site.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2011-10-28 14:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 14:31 Subject: UBIFS and small dynamic files Daniel Wagener
2011-10-24 3:21 ` Jon Povey
2011-10-28 14:03 ` Artem Bityutskiy [this message]
2011-10-25 7:52 ` Artem Bityutskiy
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=1319810603.31184.184.camel@sauron \
--to=dedekind1@gmail.com \
--cc=Jon.Povey@racelogic.co.uk \
--cc=daniel.wagener@kernelconcepts.de \
--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