aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/virtio_blk.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 20:07:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-22 20:07:18 -0400
commita2887097f25cd38cadfc11d10769e2b349fb5eca (patch)
treecd4adcb305365d6ba9acd2c02d4eb9d0125c6f8d /drivers/block/virtio_blk.c
parent8abfc6e7a45eb74e51904bbae676fae008b11366 (diff)
parent005a1d15f5a6b2bb4ada80349513effbf22b4588 (diff)
Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block
* 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block: (46 commits) xen-blkfront: disable barrier/flush write support Added blk-lib.c and blk-barrier.c was renamed to blk-flush.c block: remove BLKDEV_IFL_WAIT aic7xxx_old: removed unused 'req' variable block: remove the BH_Eopnotsupp flag block: remove the BLKDEV_IFL_BARRIER flag block: remove the WRITE_BARRIER flag swap: do not send discards as barriers fat: do not send discards as barriers ext4: do not send discards as barriers jbd2: replace barriers with explicit flush / FUA usage jbd2: Modify ASYNC_COMMIT code to not rely on queue draining on barrier jbd: replace barriers with explicit flush / FUA usage nilfs2: replace barriers with explicit flush / FUA usage reiserfs: replace barriers with explicit flush / FUA usage gfs2: replace barriers with explicit flush / FUA usage btrfs: replace barriers with explicit flush / FUA usage xfs: replace barriers with explicit flush / FUA usage block: pass gfp_mask and flags to sb_issue_discard dm: convey that all flushes are processed as empty ...
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r--drivers/block/virtio_blk.c37
1 files changed, 6 insertions, 31 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 8320490226b7..6ecf89cdf006 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -127,9 +127,6 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
127 } 127 }
128 } 128 }
129 129
130 if (vbr->req->cmd_flags & REQ_HARDBARRIER)
131 vbr->out_hdr.type |= VIRTIO_BLK_T_BARRIER;
132
133 sg_set_buf(&vblk->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr)); 130 sg_set_buf(&vblk->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr));
134 131
135 /* 132 /*
@@ -379,31 +376,9 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
379 vblk->disk->driverfs_dev = &vdev->dev; 376 vblk->disk->driverfs_dev = &vdev->dev;
380 index++; 377 index++;
381 378
382 if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH)) { 379 /* configure queue flush support */
383 /* 380 if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH))
384 * If the FLUSH feature is supported we do have support for 381 blk_queue_flush(q, REQ_FLUSH);
385 * flushing a volatile write cache on the host. Use that
386 * to implement write barrier support.
387 */
388 blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH);
389 } else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) {
390 /*
391 * If the BARRIER feature is supported the host expects us
392 * to order request by tags. This implies there is not
393 * volatile write cache on the host, and that the host
394 * never re-orders outstanding I/O. This feature is not
395 * useful for real life scenarious and deprecated.
396 */
397 blk_queue_ordered(q, QUEUE_ORDERED_TAG);
398 } else {
399 /*
400 * If the FLUSH feature is not supported we must assume that
401 * the host does not perform any kind of volatile write
402 * caching. We still need to drain the queue to provider
403 * proper barrier semantics.
404 */
405 blk_queue_ordered(q, QUEUE_ORDERED_DRAIN);
406 }
407 382
408 /* If disk is read-only in the host, the guest should obey */ 383 /* If disk is read-only in the host, the guest should obey */
409 if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) 384 if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
@@ -522,9 +497,9 @@ static const struct virtio_device_id id_table[] = {
522}; 497};
523 498
524static unsigned int features[] = { 499static unsigned int features[] = {
525 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, 500 VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, VIRTIO_BLK_F_GEOMETRY,
526 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, 501 VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, VIRTIO_BLK_F_SCSI,
527 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY 502 VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY
528}; 503};
529 504
530/* 505/*