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 3/3] xen-blkfront: If no barrier or flush is supporte

To: linux-kernel@xxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3/3] xen-blkfront: If no barrier or flush is supported, use invalid operation.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Fri, 9 Sep 2011 14:31:00 -0400
Cc: axboe@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, JBeulich@xxxxxxxxxx, jeremy.fitzhardinge@xxxxxxxxxx, stable@xxxxxxxxxx
Delivery-date: Fri, 09 Sep 2011 11:34:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1315593060-20031-1-git-send-email-konrad.wilk@xxxxxxxxxx>
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>
References: <1315593060-20031-1-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
By default we would set the info->flush_op=0, and zero maps
to BLKIF_OP_READ request code. So if the backend did not support
either barrier ('feature-barrier') or flush ('feature-flush-cache')
we would end up using that opcode for the flush/barrier request, meaning
we actually do a READ request. Fortunatly for us, __generic_make_request
checks q->flush_flags and realizes that we don't do FLUSH and removes
the REQ_FLUSH | REQ_FUA so we never end up issuing a READ request
for a flush request. However, other third party implementations of
__make_request might not be so smart, so lets fix this up.

CC: stable@xxxxxxxxxx
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 drivers/block/xen-blkfront.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index e205d91..c4aa9da 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -97,7 +97,7 @@ struct blkfront_info
        struct blk_shadow shadow[BLK_RING_SIZE];
        unsigned long shadow_free;
        unsigned int feature_flush;
-       unsigned int flush_op;
+       int flush_op;
        unsigned int feature_discard;
        unsigned int discard_granularity;
        unsigned int discard_alignment;
@@ -774,7 +774,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
                                if (error == -EOPNOTSUPP)
                                        error = 0;
                                info->feature_flush = 0;
-                               info->flush_op = 0;
+                               info->flush_op = -1; /* 0 is BLKIF_OP_READ */
                                xlvbd_flush(info);
                        }
                        /* fall through */
@@ -1207,7 +1207,7 @@ static void blkfront_connect(struct blkfront_info *info)
        }
 
        info->feature_flush = 0;
-       info->flush_op = 0;
+       info->flush_op = -1; /* 0 is BLKIF_OP_READ */
 
        err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
                            "feature-barrier", "%d", &barrier,
@@ -1234,7 +1234,7 @@ static void blkfront_connect(struct blkfront_info *info)
        if (!err && flush)
                info->flush_op = BLKIF_OP_FLUSH_DISKCACHE;
 
-       if (info->flush_op)
+       if (info->flush_op > 0)
                info->feature_flush = REQ_FLUSH | REQ_FUA;
 
        err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-- 
1.7.4.1


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