From patchwork Wed Oct 14 12:03:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 53656 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9EC90pX007742 for ; Wed, 14 Oct 2009 12:09:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758587AbZJNMDr (ORCPT ); Wed, 14 Oct 2009 08:03:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756353AbZJNMDr (ORCPT ); Wed, 14 Oct 2009 08:03:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47758 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754707AbZJNMDq (ORCPT ); Wed, 14 Oct 2009 08:03:46 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9EC3Dno001304; Wed, 14 Oct 2009 08:03:13 -0400 Received: from localhost.localdomain (vpn-12-74.rdu.redhat.com [10.11.12.74]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9EC39Wd019417; Wed, 14 Oct 2009 08:03:10 -0400 From: Avi Kivity To: Christoph Hellwig Cc: Matthew Tippett , Dustin Kirkland , Anthony Liguori , RW , 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 Message-Id: <1255521788-24346-1-git-send-email-avi@redhat.com> In-Reply-To: <4AD5B00D.102@redhat.com> References: <4AD5B00D.102@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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))