diff options
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r-- | drivers/block/virtio_blk.c | 37 |
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 | ||
524 | static unsigned int features[] = { | 499 | static 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 | /* |