diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/virtio_blk.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index dd7ea203f940..42251095134f 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -196,6 +196,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
196 | int err; | 196 | int err; |
197 | u64 cap; | 197 | u64 cap; |
198 | u32 v; | 198 | u32 v; |
199 | u32 blk_size; | ||
199 | 200 | ||
200 | if (index_to_minor(index) >= 1 << MINORBITS) | 201 | if (index_to_minor(index) >= 1 << MINORBITS) |
201 | return -ENOSPC; | 202 | return -ENOSPC; |
@@ -290,6 +291,13 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
290 | if (!err) | 291 | if (!err) |
291 | blk_queue_max_hw_segments(vblk->disk->queue, v); | 292 | blk_queue_max_hw_segments(vblk->disk->queue, v); |
292 | 293 | ||
294 | /* Host can optionally specify the block size of the device */ | ||
295 | err = virtio_config_val(vdev, VIRTIO_BLK_F_BLK_SIZE, | ||
296 | offsetof(struct virtio_blk_config, blk_size), | ||
297 | &blk_size); | ||
298 | if (!err) | ||
299 | blk_queue_hardsect_size(vblk->disk->queue, blk_size); | ||
300 | |||
293 | add_disk(vblk->disk); | 301 | add_disk(vblk->disk); |
294 | return 0; | 302 | return 0; |
295 | 303 | ||
@@ -330,7 +338,7 @@ static struct virtio_device_id id_table[] = { | |||
330 | 338 | ||
331 | static unsigned int features[] = { | 339 | static unsigned int features[] = { |
332 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, | 340 | VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, |
333 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, | 341 | VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, |
334 | }; | 342 | }; |
335 | 343 | ||
336 | static struct virtio_driver virtio_blk = { | 344 | static struct virtio_driver virtio_blk = { |