kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Matthew Tippett <tippettm@gmail.com>,
	Dustin Kirkland <dustin.kirkland@gmail.com>,
	Anthony Liguori <anthony@codemonkey.ws>, RW <kvm@tauceti.net>,
	kvm@vger.kernel.org
Subject: [PATCH] virtio-blk: fallback to draining the queue if barrier ops are not supported
Date: Wed, 14 Oct 2009 21:03:08 +0900	[thread overview]
Message-ID: <1255521788-24346-1-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <4AD5B00D.102@redhat.com>

Early implementations of virtio devices did not support barrier operations,
but did commit the data to disk.  In such cases, drain the queue to emulate
barrier operations.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 drivers/block/virtio_blk.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 43f1938..2627cc3 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -354,12 +354,16 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
 	vblk->disk->driverfs_dev = &vdev->dev;
 	index++;
 
-	/* If barriers are supported, tell block layer that queue is ordered */
+	/* If barriers are supported, tell block layer that queue is ordered;
+	 * otherwise just drain the queue.
+	 */
 	if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH))
 		blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_DRAIN_FLUSH,
 				  virtblk_prepare_flush);
 	else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
 		blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL);
+	else
+		blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_DRAIN, NULL);
 
 	/* If disk is read-only in the host, the guest should obey */
 	if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
-- 
1.6.2.5


  reply	other threads:[~2009-10-14 12:03 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-25  7:00 sync guest calls made async on host - SQLite performance RW
2009-09-27 11:37 ` Avi Kivity
2009-09-27 12:07   ` Matthew Tippett
2009-09-29 19:02     ` Anthony Liguori
2009-09-29 19:32       ` Matthew Tippett
2009-09-29 20:46         ` Dustin Kirkland
2009-09-29 20:51         ` Anthony Liguori
2009-10-07 14:15           ` Matthew Tippett
2009-10-07 16:53           ` Matthew Tippett
2009-10-07 18:59             ` Dustin Kirkland
2009-10-07 19:31               ` Matthew Tippett
2009-10-07 20:12                 ` Avi Kivity
2009-10-07 21:01                   ` Matthew Tippett
2009-10-09  6:05                 ` Dustin Kirkland
     [not found]                 ` <4ACE0196.9010904@gmail.com>
     [not found]                   ` <d9c105ea0910082312n7218e1abhc69a2be660838e89@mail.gmail.com>
     [not found]                     ` <f28b49ce0910090425p385636c3he6dfb7595927d7e4@mail.gmail.com>
2009-10-09 15:18                       ` Dustin Kirkland
2009-10-09 19:06                         ` Matthew Tippett
2009-10-11  9:16                           ` Avi Kivity
2009-10-13 22:37                             ` Christoph Hellwig
2009-10-14 11:03                               ` Avi Kivity
2009-10-14 12:03                                 ` Avi Kivity [this message]
2009-10-14 14:46                                   ` [PATCH] virtio-blk: fallback to draining the queue if barrier ops are not supported Javier Guerra
2009-10-14 16:53                                     ` Avi Kivity
2009-10-14 15:38                                   ` Michael Tokarev
2009-10-14 15:46                                     ` Christoph Hellwig
2009-10-14 13:41                                 ` sync guest calls made async on host - SQLite performance Christoph Hellwig
2009-10-14 16:56                                   ` Avi Kivity
2009-10-14 17:02                                     ` Christoph Hellwig
2009-10-14 22:54                                       ` Anthony Liguori
2009-10-14 23:37                                         ` Avi Kivity
2009-10-15 12:17                                         ` Christoph Hellwig
2009-10-15 12:36                                           ` Christoph Hellwig
2009-10-19  5:56                                           ` Avi Kivity
2009-10-13 23:08                           ` Anthony Liguori
2009-10-14  2:09                             ` Matthew Tippett
2009-10-14  4:12                               ` Dustin Kirkland
2009-10-14 11:32                                 ` Matthew Tippett

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=1255521788-24346-1-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=dustin.kirkland@gmail.com \
    --cc=hch@lst.de \
    --cc=kvm@tauceti.net \
    --cc=kvm@vger.kernel.org \
    --cc=tippettm@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).