block: make available VIRTIO_BLK_F_SEG_MAX

This allows the guest to put in more than 1 segment per request. It can
improve the throughput of the system.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2024-12-21 00:38:10 +00:00
parent 1cdb91a40f
commit d0a1171870

View File

@ -625,6 +625,7 @@ impl Block {
| (1u64 << VIRTIO_BLK_F_CONFIG_WCE) | (1u64 << VIRTIO_BLK_F_CONFIG_WCE)
| (1u64 << VIRTIO_BLK_F_BLK_SIZE) | (1u64 << VIRTIO_BLK_F_BLK_SIZE)
| (1u64 << VIRTIO_BLK_F_TOPOLOGY) | (1u64 << VIRTIO_BLK_F_TOPOLOGY)
| (1u64 << VIRTIO_BLK_F_SEG_MAX)
| (1u64 << VIRTIO_RING_F_EVENT_IDX) | (1u64 << VIRTIO_RING_F_EVENT_IDX)
| (1u64 << VIRTIO_RING_F_INDIRECT_DESC); | (1u64 << VIRTIO_RING_F_INDIRECT_DESC);
if iommu { if iommu {
@ -660,6 +661,7 @@ impl Block {
physical_block_exp, physical_block_exp,
min_io_size: (topology.minimum_io_size / logical_block_size) as u16, min_io_size: (topology.minimum_io_size / logical_block_size) as u16,
opt_io_size: (topology.optimal_io_size / logical_block_size) as u32, opt_io_size: (topology.optimal_io_size / logical_block_size) as u32,
seg_max: std::cmp::max(queue_size as u32, 3) - 2,
..Default::default() ..Default::default()
}; };