From: Andrew Morton <akpm@linux-foundation.org>
To: Chris Mason <chris.mason@oracle.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Correct behavior on O_DIRECT sparse file writes
Date: Fri, 12 Oct 2007 14:02:33 -0700 [thread overview]
Message-ID: <20071012140233.ad7b517d.akpm@linux-foundation.org> (raw)
In-Reply-To: <1192221567.1375.81.camel@think.oraclecorp.com>
On Fri, 12 Oct 2007 16:39:27 -0400
Chris Mason <chris.mason@oracle.com> wrote:
> Hello everyone,
>
> The test below creates a sparse file and then fills a hole with
> O_DIRECT. As far as I can tell from reading generic_osync_inode, the
> filesystem metadata is only forced to disk if i_size changes during the
> file write. I've tested ext3, xfs and reiserfs and they all skip the
> commit when filling holes.
>
> I would argue that filling holes via O_DIRECT is supposed to commit the
> metadata required to find those file blocks later. At least on ext3,
> O_SYNC does force a commit on fill holes (haven't tested others).
>
> So, is the current behavior a bug or a feature?
I don't think it's a bug. Sure, O_DIRECT is synchronous, but that's
because it is, err, direct. Not because it provides extra data-integrity
guarantees. If you want those guarantees, use O_SYNC as well.
> dd if=/dev/zero of=foo bs=1M seek=1 count=1 oflag=direct
>
> hexdump foo | head -n 2
> 0000000 62b1 ea2d 73e8 c64f f5ef 1af5 dd09 8ccd
> 0000010 75ec 9581 e0ea ae9b e28f b76d a700 4d5b
>
> dd if=/dev/urandom of=foo bs=4k count=1 conv=notrunc oflag=direct
> reboot -nf
>
> (after reboot)
>
> hexdump foo
> 0000000 0000 0000 0000 0000 0000 0000 0000 0000
> *
> 0200000
>
> -chris
>
next prev parent reply other threads:[~2007-10-12 21:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-12 20:39 Correct behavior on O_DIRECT sparse file writes Chris Mason
2007-10-12 21:02 ` Andrew Morton [this message]
2007-10-13 11:24 ` Florian Weimer
2007-10-15 15:36 ` Chuck Lever
2007-10-15 16:53 ` Bryan Henderson
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=20071012140233.ad7b517d.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=chris.mason@oracle.com \
--cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.