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 1/3] xen/blk[front|back]: Use the full FLUSH | FUA in

To: linux-kernel@xxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/3] xen/blk[front|back]: Use the full FLUSH | FUA instead of just FLUSH.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Fri, 9 Sep 2011 14:30:59 -0400
Cc: axboe@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, jeremy.fitzhardinge@xxxxxxxxxx, JBeulich@xxxxxxxxxx, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Fri, 09 Sep 2011 11:33:30 -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
During a FLUSH we can pass sector number that we want to
have flushed - which is what FUA requests are.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 drivers/block/xen-blkback/blkback.c |   11 ++++++-----
 drivers/block/xen-blkfront.c        |   12 ++++++------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c 
b/drivers/block/xen-blkback/blkback.c
index 9713d5a..6ade8ab 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -603,7 +603,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
                break;
        case BLKIF_OP_FLUSH_DISKCACHE:
                blkif->st_f_req++;
-               operation = WRITE_FLUSH;
+               operation = WRITE_FLUSH_FUA;
                break;
        case BLKIF_OP_DISCARD:
                blkif->st_ds_req++;
@@ -618,7 +618,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 
        /* Check that the number of segments is sane. */
        nseg = req->nr_segments;
-       if (unlikely(nseg == 0 && operation != WRITE_FLUSH &&
+       if (unlikely(nseg == 0 && operation != WRITE_FLUSH_FUA &&
                                operation != REQ_DISCARD) ||
            unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) {
                pr_debug(DRV_PFX "Bad number of segments in request (%d)\n",
@@ -707,9 +707,10 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 
        /* This will be hit if the operation was a flush or discard. */
        if (!bio) {
-               BUG_ON(operation != WRITE_FLUSH && operation != REQ_DISCARD);
+               BUG_ON(operation != WRITE_FLUSH_FUA &&
+                      operation != REQ_DISCARD);
 
-               if (operation == WRITE_FLUSH) {
+               if (operation == WRITE_FLUSH_FUA) {
                        bio = bio_alloc(GFP_KERNEL, 0);
                        if (unlikely(bio == NULL))
                                goto fail_put_bio;
@@ -743,7 +744,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 
        if (operation == READ)
                blkif->st_rd_sect += preq.nr_sects;
-       else if (operation == WRITE || operation == WRITE_FLUSH)
+       else if (operation == WRITE || operation == WRITE_FLUSH_FUA)
                blkif->st_wr_sect += preq.nr_sects;
 
        return 0;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 86e2c63..e205d91 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -1220,10 +1220,9 @@ static void blkfront_connect(struct blkfront_info *info)
         *
         * If there are barriers, then we use flush.
         */
-       if (!err && barrier) {
-               info->feature_flush = REQ_FLUSH | REQ_FUA;
+       if (!err && barrier)
                info->flush_op = BLKIF_OP_WRITE_BARRIER;
-       }
+
        /*
         * And if there is "feature-flush-cache" use that above
         * barriers.
@@ -1232,10 +1231,11 @@ static void blkfront_connect(struct blkfront_info *info)
                            "feature-flush-cache", "%d", &flush,
                            NULL);
 
-       if (!err && flush) {
-               info->feature_flush = REQ_FLUSH;
+       if (!err && flush)
                info->flush_op = BLKIF_OP_FLUSH_DISKCACHE;
-       }
+
+       if (info->flush_op)
+               info->feature_flush = REQ_FLUSH | REQ_FUA;
 
        err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
                            "feature-discard", "%d", &discard,
-- 
1.7.4.1


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