Skip to content

Commit

Permalink
virtio: set max_segment_size and max_sectors to infinite.
Browse files Browse the repository at this point in the history
Setting max_segment_size allows more than 64k per sg element, unless
the host specified a limit.  Setting max_sectors indicates that our
max_hw_segments is the only limit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Rusty Russell committed Dec 29, 2008
1 parent 1b4aa2f commit 4b7f7e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,18 @@ static int virtblk_probe(struct virtio_device *vdev)
}
set_capacity(vblk->disk, cap);

/* No real sector limit. */
blk_queue_max_sectors(vblk->disk->queue, -1U);

/* Host can optionally specify maximum segment size and number of
* segments. */
err = virtio_config_val(vdev, VIRTIO_BLK_F_SIZE_MAX,
offsetof(struct virtio_blk_config, size_max),
&v);
if (!err)
blk_queue_max_segment_size(vblk->disk->queue, v);
else
blk_queue_max_segment_size(vblk->disk->queue, -1UL);

err = virtio_config_val(vdev, VIRTIO_BLK_F_SEG_MAX,
offsetof(struct virtio_blk_config, seg_max),
Expand Down

0 comments on commit 4b7f7e2

Please sign in to comment.