From f7df9f0c55908ace025ba804dcce72dac6e9730a Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Fri, 22 Jul 2011 09:30:15 -0400 Subject: [PATCH] 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 --- drivers/block/xen-blkback/blkback.c | 8 ++++---- drivers/block/xen-blkfront.c | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 2330a9ad5e95..8c42986a9525 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -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; diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 9ea8c2576c70..67d656b1adc6 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -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", -- 2.39.5