From: Calvin Walton <calvin.walton@gmail.com>
To: Ric Wheeler <ricwheeler@gmail.com>
Cc: Olaf van der Spek <olafvdspek@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: Atomic non-durable file write API
Date: Sat, 18 Dec 2010 17:15:43 -0500 [thread overview]
Message-ID: <1292710543.17128.14.camel@nayuki> (raw)
In-Reply-To: <4D0A7278.3080506@gmail.com>
On Thu, 2010-12-16 at 15:11 -0500, Ric Wheeler wrote:
> On 12/16/2010 07:22 AM, Olaf van der Spek wrote:
> > On Thu, Dec 9, 2010 at 1:03 PM, Olaf van der Spek<olafvdspek@gmail.com> wrote:
> >> Hi,
> >>
> >> Since the introduction of ext4, some apps/users have had issues with
> >> file corruption after a system crash. It's not a bug in the FS AFAIK
> >> and it's not exclusive to ext4.
> >> Writing a temp file, fsync, rename is often proposed. However, the
> >> durable aspect of fsync isn't always required and this way has other
> >> issues.
> >> What is the recommended way for atomic non-durable (complete) file writes?
> >>
> >> I'm also wondering why FSs commit after open/truncate but before
> >> write/close. AFAIK this isn't necessary and thus suboptimal.
> > Somebody?
> >
> > Olaf
>
> Getting an atomic IO from user space down to storage is not really trivial.
>
> What I think you would have to do is:
>
> (1) understand the alignment and minimum IO size of your target storage device
> which you can get from /sys/block (or libblkid)
Hmm. I’m doing a little interpretation of what Olaf said here; but I
think you may have misunderstood the question?
He doesn’t care about whether or not the file is securely written to
disk (durable); however he doesn’t want to see any partially written
files. In other words, something like
1. Write to temp file
2. Rename temp file over original file
Where the rename is only committed to disk once the entire contents of
the file have been written securely – whenever that may eventually
happen.
He doesn’t want to synchronously wait for the file to be written,
because the new data isn’t particularly important. The only important
thing is that the file either contains the old or new data after a
filesystem crash; not incomplete data. So, it’s more of an ordering
problem, I think? (Analogous to putting some sort of barrier between the
file write/close and the file rename to maintain ordering.)
Hopefully I’ve interpreted the original question correctly, because this
is something I would find interesting as well.
--
Calvin Walton <calvin.walton@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-12-18 22:15 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTing7+SK+pavFehR4AGDbRRfFwvvzNxgWQ3zRp+O@mail.gmail.com>
2010-12-09 12:03 ` Atomic non-durable file write API Olaf van der Spek
2010-12-16 12:22 ` Olaf van der Spek
2010-12-16 20:11 ` Ric Wheeler
2010-12-18 22:15 ` Calvin Walton [this message]
2010-12-19 16:39 ` Olaf van der Spek
2010-12-23 15:49 ` Olaf van der Spek
2010-12-23 21:51 ` Neil Brown
2010-12-23 22:22 ` Ted Ts'o
2010-12-24 0:30 ` Christian Stroetmann
2010-12-24 0:48 ` Ted Ts'o
2010-12-24 1:00 ` Christian Stroetmann
2010-12-24 9:51 ` Ted Ts'o
2010-12-24 11:14 ` Olaf van der Spek
2010-12-24 11:25 ` Christian Stroetmann
2010-12-25 3:15 ` Ted Ts'o
2010-12-25 10:41 ` Olaf van der Spek
2010-12-25 11:33 ` Nick Piggin
2010-12-25 15:24 ` Olaf van der Spek
2010-12-25 17:25 ` Nick Piggin
2010-12-26 15:08 ` Olaf van der Spek
2010-12-26 15:55 ` Boaz Harrosh
2010-12-26 16:02 ` Olaf van der Spek
2010-12-26 16:27 ` Boaz Harrosh
2010-12-26 18:26 ` Olaf van der Spek
2010-12-26 16:43 ` Nick Piggin
2010-12-26 18:51 ` Olaf van der Spek
2010-12-26 22:10 ` Ted Ts'o
2010-12-27 0:30 ` Christian Stroetmann
2010-12-27 1:04 ` Ted Ts'o
2010-12-27 1:30 ` Christian Stroetmann
2010-12-27 2:53 ` Ted Ts'o
2010-12-27 10:21 ` Olaf van der Spek
2010-12-27 11:07 ` Marco Stornelli
2010-12-27 15:30 ` Christian Stroetmann
2010-12-27 19:07 ` Olaf van der Spek
2010-12-27 19:30 ` Christian Stroetmann
2010-12-28 17:22 ` Olaf van der Spek
2010-12-28 20:59 ` Neil Brown
2010-12-28 22:00 ` Greg Freemyer
2010-12-28 22:06 ` Olaf van der Spek
2010-12-28 22:15 ` Greg Freemyer
2010-12-28 22:28 ` Olaf van der Spek
2010-12-28 22:35 ` Neil Brown
2010-12-29 11:05 ` Dave Chinner
2010-12-28 22:10 ` Olaf van der Spek
2010-12-28 22:31 ` Neil Brown
2010-12-28 22:54 ` Olaf van der Spek
2010-12-28 23:42 ` Ted Ts'o
2010-12-29 9:09 ` Olaf van der Spek
2010-12-29 15:30 ` Christian Stroetmann
2010-12-29 15:41 ` Olaf van der Spek
2010-12-29 16:30 ` Christian Stroetmann
2010-12-29 17:14 ` Olaf van der Spek
2010-12-30 0:50 ` Neil Brown
2011-01-07 14:23 ` Olaf van der Spek
2010-12-27 4:12 ` Nick Piggin
2010-12-27 11:48 ` Olaf van der Spek
2010-12-27 12:43 ` Olaf van der Spek
2010-12-28 0:45 ` Ted Ts'o
2010-12-24 11:21 ` Christian Stroetmann
2010-12-24 11:17 ` Olaf van der Spek
2010-12-24 11:29 ` Christian Stroetmann
2010-12-24 11:30 ` Olaf van der Spek
2010-12-25 21:40 ` Neil Brown
2010-12-23 22:43 ` Dave Chinner
2010-12-23 22:47 ` Ted Ts'o
2010-12-26 9:59 ` Amir Goldstein
2010-12-26 15:23 ` Olaf van der Spek
2010-12-26 16:52 ` Nick Piggin
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=1292710543.17128.14.camel@nayuki \
--to=calvin.walton@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=olafvdspek@gmail.com \
--cc=ricwheeler@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).