WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH RFC] xen/blkfront: use tagged queuing for barriers

To: Daniel Stodden <daniel.stodden@xxxxxxxxxx>
Subject: [Xen-devel] [PATCH RFC] xen/blkfront: use tagged queuing for barriers
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Thu, 22 Jul 2010 14:20:31 -0700
Cc: "Xen-devel@xxxxxxxxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxxxxxxxx>, Jake Wires <Jake.Wires@xxxxxxxxxx>
Delivery-date: Thu, 22 Jul 2010 14:21:19 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Thunderbird/3.0.5
When barriers are supported, then use QUEUE_ORDERED_TAG to tell the block
subsystem that it doesn't need to do anything else with the barriers.
Previously we used ORDERED_DRAIN which caused the block subsystem to
drain all pending IO before submitting the barrier, which would be
very expensive.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 92091a7..b61a021 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -418,10 +418,20 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 
sector_size)
 static int xlvbd_barrier(struct blkfront_info *info)
 {
        int err;
+       unsigned ordered = QUEUE_ORDERED_NONE;
 
-       err = blk_queue_ordered(info->rq,
-                               info->feature_barrier ? QUEUE_ORDERED_DRAIN : 
QUEUE_ORDERED_NONE,
-                               NULL);
+       /*
+        * If we don't have barrier support, then there's really no
+        * way to guarantee write ordering, so we really just have to
+        * send writes to the backend and hope for the best.  If
+        * barriers are supported, we don't really know what the
+        * flushing semantics of the barrier are, so again, tag the
+        * requests in order and hope for the best.
+        */
+       if (info->feature_barrier)
+               ordered = QUEUE_ORDERED_TAG;
+
+       err = blk_queue_ordered(info->rq, ordered, NULL);
 
        if (err)
                return err;
@@ -508,8 +518,7 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
        info->rq = gd->queue;
        info->gd = gd;
 
-       if (info->feature_barrier)
-               xlvbd_barrier(info);
+       xlvbd_barrier(info);
 
        if (vdisk_info & VDISK_READONLY)
                set_disk_ro(gd, 1);



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel