[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/3] xen/blk[front|back]: Use the full FLUSH | FUA instead of just FLUSH.



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.