public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Avi Kivity <avi@redhat.com>, Christoph Hellwig <hch@lst.de>,
	Rusty Russell <rusty@rustcorp.com.au>,
	kvm@vger.kernel.org
Subject: Re: [PATCH, RFC] virtio_blk: add cache flush command
Date: Tue, 12 May 2009 09:23:51 +0200	[thread overview]
Message-ID: <20090512072351.GB5627@lst.de> (raw)
In-Reply-To: <4A0864CE.10505@codemonkey.ws>

On Mon, May 11, 2009 at 12:47:58PM -0500, Anthony Liguori wrote:
> But how do we define the data integrity guarantees to the user of 
> cache=writeback+fsync?  It seems to require a rather detailed knowledge 
> of Linux's use of T_FLUSH operations.

It does work the same as for disks with writeback caches.  If a barrier
request completes the filesystem can assume all previous I/O on this
disk has finished before the barrier request, and the barrier request
has finished after these without any later request being finished before
it.  If a cache flush is issued the cache as of that point in time is
flushed (used for fsync).

> Right now, it's fairly easy to understand.  cache=none and 
> cache=writethrough guarantee that all write operations that the guest 
> thinks have completed are completed.  cache=writeback provides no such 
> guarantee.

As said above with barriers it indeed does.

> cache=writeback+fsync would guarantee that only operations that include 
> a T_FLUSH are present on disk which currently includes fsyncs but does 
> not include O_DIRECT writes.  I guess whether O_SYNC does a T_FLUSH also 
> has to be determined.

O_SYNC and O_DIRECT do it at least on XFS due to updating metadata after
the write.  I can't vouch for implementation details on other
filesystems.


  parent reply	other threads:[~2009-05-12  7:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-11  8:39 [PATCH, RFC] virtio_blk: add cache flush command Christoph Hellwig
2009-05-11 14:51 ` Anthony Liguori
2009-05-11 15:40   ` Christoph Hellwig
2009-05-11 15:45     ` Avi Kivity
2009-05-11 16:28       ` Christoph Hellwig
2009-05-11 16:49         ` Avi Kivity
2009-05-11 17:47           ` Anthony Liguori
2009-05-11 18:00             ` Avi Kivity
2009-05-11 18:29               ` Anthony Liguori
2009-05-11 18:40                 ` Avi Kivity
2009-05-18 12:03                 ` Christoph Hellwig
2009-05-12  7:23             ` Christoph Hellwig [this message]
2009-05-12  7:19           ` Christoph Hellwig
2009-05-12  8:35             ` Avi Kivity
2009-05-18 12:06               ` Christoph Hellwig
2009-05-11 16:38     ` Anthony Liguori
2009-05-12  7:26       ` Christoph Hellwig
2009-05-12 13:54 ` Rusty Russell
2009-05-12 14:18   ` Christian Borntraeger
2009-05-13  1:52     ` Rusty Russell
2009-05-18 12:07     ` Christoph Hellwig

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=20090512072351.GB5627@lst.de \
    --to=hch@lst.de \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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