]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen/blk[front|back]: Use the full FLUSH | FUA instead of just FLUSH.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 22 Jul 2011 13:30:15 +0000 (09:30 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 15 Aug 2011 12:57:38 +0000 (08:57 -0400)
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@oracle.com>
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkfront.c

index 2330a9ad5e9568c2e4e1944e76eca10f7c5cdb53..8c42986a95256f7fcd878f316f41541ad6dbb5ff 100644 (file)
@@ -561,7 +561,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_WRITE_BARRIER:
        default:
@@ -572,7 +572,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) ||
            unlikely(nseg > BLKIF_MAX_SEGMENTS_PER_REQUEST)) {
                pr_debug(DRV_PFX "Bad number of segments in request (%d)\n",
                         nseg);
@@ -656,7 +656,7 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
 
        /* This will be hit if the operation was a flush. */
        if (!bio) {
-               BUG_ON(operation != WRITE_FLUSH);
+               BUG_ON(operation != WRITE_FLUSH_FUA);
 
                bio = bio_alloc(GFP_KERNEL, 0);
                if (unlikely(bio == NULL))
@@ -685,7 +685,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;
index 9ea8c2576c70e768f22ad8ea2cc423337611fb4f..67d656b1adc6894e1f57b5706c7b79d1868a0f69 100644 (file)
@@ -1148,7 +1148,7 @@ static void blkfront_connect(struct blkfront_info *info)
                return;
        }
 
-       info->feature_flush = 0;
+       info->feature_flush = REQ_FLUSH | REQ_FUA;
        info->flush_op = 0;
 
        err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
@@ -1163,7 +1163,6 @@ 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;
                info->flush_op = BLKIF_OP_WRITE_BARRIER;
        }
        /*
@@ -1175,10 +1174,12 @@ static void blkfront_connect(struct blkfront_info *info)
                            NULL);
 
        if (!err && flush) {
-               info->feature_flush = REQ_FLUSH;
                info->flush_op = BLKIF_OP_FLUSH_DISKCACHE;
        }
-               
+
+       if (!flush && !barrier)
+               info->feature_flush = 0;
+
        err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size);
        if (err) {
                xenbus_dev_fatal(info->xbdev, err, "xlvbd_add at %s",