From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
Laurent Vivier <Laurent.Vivier@bull.net>,
Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] Re: [PATCH][v2] Align file accesses with cache=off (O_DIRECT)
Date: Wed, 21 May 2008 08:55:55 -0500 [thread overview]
Message-ID: <483429EB.7070705@codemonkey.ws> (raw)
In-Reply-To: <20080521134154.GA15210@shareable.org>
Jamie Lokier wrote:
> Avi Kivity wrote:
>
>> Jamie Lokier wrote:
>>
>>> Why would O_SYNC be better than O_DIRECT?
>>>
>> O_SYNC is a write-through cache. O_DIRECT is completely uncached. Both
>> have their uses (including in this context), so you can't say one is
>> better than the other.
>>
>
> Fine, but the question is: why would O_SYNC be better for
> *data integrity* than O_DIRECT? Referring to:
>
"cached" is not a terribly accurate term. O_DIRECT avoids the host page
cache but it doesn't guarantee that the disk is using write-through.
For that, you need to use hdparm.
O_SYNC basically turns the host page cache into a write-through cache.
In terms of data integrity, the only question that matters is whether
you're misleading the guest into thinking data is on the disk when it
isn't. Both O_DIRECT and O_SYNC accomplish this.
If you just are concerned with data integrity, O_SYNC is probably better
because you get the benefits of host caching. O_DIRECT is really for
circumstances where you know that using the host page cache is going to
reduce performance.
Regards,
Anthony Liguori
> Anthony Liguori wrote:
>
>> For people that care about data integrity, we should be using O_SYNC,
>> not O_DIRECT anyway.
>>
>
> Could it be connected with this, from elsewhere?
>
> Rob van Nieuwkerk wrote:
>
>> It appears that somewhere between RH kernels 2.4.18-27.7.x and 2.4.20-18.9
>> something has changed so that my application needs a O_SYNC too besides
>> the O_DIRECT to make sure that writes will be synchronous. If I leave
>> the O_SYNC out with 2.4.20-18.9 the write will happen physically 35
>> seconds after the write()
>>
>
> For that, O_SYNC is used in conjunction with O_DIRECT, rather than
> instead of it.
>
> -- Jamie
>
>
>
>
next prev parent reply other threads:[~2008-05-21 13:56 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-20 11:32 [Qemu-devel] [PATCH][v2] Align file accesses with cache=off (O_DIRECT) Laurent Vivier
2008-05-20 19:47 ` [Qemu-devel] " Anthony Liguori
2008-05-20 22:36 ` Jamie Lokier
2008-05-20 22:52 ` Paul Brook
2008-05-20 22:59 ` Laurent Vivier
2008-05-21 0:54 ` Paul Brook
2008-05-21 7:59 ` Laurent Vivier
2008-05-21 0:58 ` Anthony Liguori
2008-05-21 1:04 ` Jamie Lokier
2008-05-21 1:05 ` Anthony Liguori
2008-05-21 8:06 ` Kevin Wolf
2008-05-21 1:05 ` Paul Brook
2008-05-21 1:14 ` Anthony Liguori
2008-05-21 8:24 ` Kevin Wolf
2008-05-21 12:26 ` Jamie Lokier
2008-05-21 12:37 ` Avi Kivity
2008-05-21 13:41 ` Jamie Lokier
2008-05-21 13:55 ` Anthony Liguori [this message]
2008-05-21 14:17 ` Avi Kivity
2008-05-21 14:26 ` Anthony Liguori
2008-05-21 14:57 ` Avi Kivity
2008-05-21 15:34 ` Jamie Lokier
2008-05-21 16:02 ` Anthony Liguori
2008-05-21 16:24 ` Jamie Lokier
2008-05-21 16:48 ` Avi Kivity
2008-05-21 17:01 ` Andrea Arcangeli
2008-05-21 17:18 ` Avi Kivity
2008-05-21 17:47 ` Andrea Arcangeli
2008-05-21 17:53 ` Anthony Liguori
2008-05-21 18:08 ` Andrea Arcangeli
2008-05-21 18:25 ` Anthony Liguori
2008-05-21 20:13 ` Andrea Arcangeli
2008-05-21 20:35 ` Anthony Liguori
2008-05-21 20:42 ` Andrea Arcangeli
2008-05-21 18:29 ` Avi Kivity
2008-05-21 16:45 ` Avi Kivity
2008-05-21 16:44 ` Avi Kivity
2008-05-20 23:04 ` Laurent Vivier
2008-05-20 23:13 ` Jamie Lokier
2008-05-21 1:00 ` Anthony Liguori
2008-05-21 1:19 ` Jamie Lokier
2008-05-21 2:12 ` Anthony Liguori
2008-05-21 8:27 ` Andreas Färber
2008-05-21 14:06 ` Anthony Liguori
2008-05-21 15:31 ` Jamie Lokier
2008-05-21 11:43 ` Jamie Lokier
2008-05-23 9:12 ` Laurent Vivier
2008-05-28 7:01 ` Kevin Wolf
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=483429EB.7070705@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=Laurent.Vivier@bull.net \
--cc=blauwirbel@gmail.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.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.