diff options
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r-- | drivers/block/virtio_blk.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 79652809eee8..d10b635b3946 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -388,22 +388,15 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
388 | vblk->disk->driverfs_dev = &vdev->dev; | 388 | vblk->disk->driverfs_dev = &vdev->dev; |
389 | index++; | 389 | index++; |
390 | 390 | ||
391 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH)) { | 391 | /* |
392 | /* | 392 | * If the FLUSH feature is supported we do have support for |
393 | * If the FLUSH feature is supported we do have support for | 393 | * flushing a volatile write cache on the host. Use that to |
394 | * flushing a volatile write cache on the host. Use that | 394 | * implement write barrier support; otherwise, we must assume |
395 | * to implement write barrier support. | 395 | * that the host does not perform any kind of volatile write |
396 | */ | 396 | * caching. |
397 | blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH); | 397 | */ |
398 | } else { | 398 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH)) |
399 | /* | 399 | blk_queue_flush(q, REQ_FLUSH); |
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 | 400 | ||
408 | /* If disk is read-only in the host, the guest should obey */ | 401 | /* If disk is read-only in the host, the guest should obey */ |
409 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) | 402 | if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) |