Devices (virtio-blk, scsi, etc.) and the block layer are happy to use 32-bit for logical_block_size, physical_block_size, and min_io_size. However, the properties in BlockConf are defined as uint16_t limiting the values to 32768.
This appears unnecessary tight, and we've seen bigger block sizes handy at times. Make them 32 bit instead and lift the limitation up to 2 MiB which appears to be good enough for everybody, and matches the qcow2 cluster size limit. As the values can now be fairly big and awkward to type, make the property setter accept common size suffixes (k, m). While at this, introduce a few consistency checks on the blocksize-related values in BlockConf, to prevent their silent truncation or rounding. Also fix the accessor for opt_io_size in virtio-blk to make it consistent with the size of the field, and thus synchronize virtio-blk and scsi in the way opt_io_size is used. History: v3 -> v4: - add patch to opt_io_size width - add patch to perform consistency checks [Kevin] - check min_io_size against truncation [Kevin] v2 -> v3: - mention qcow2 cluster size limit in the log and comment [Eric] v1 -> v2: - cap the property at 2 MiB [Eric] - accept size suffixes Roman Kagan (3): virtio-blk: store opt_io_size with correct size block: consolidate blocksize properties consistency checks block: make BlockConf.*_size properties 32-bit include/hw/block/block.h | 10 ++++----- include/hw/qdev-properties.h | 2 +- hw/block/block.c | 40 +++++++++++++++++++++++++++++++++++- hw/block/fdc.c | 5 ++++- hw/block/nvme.c | 5 ++++- hw/block/virtio-blk.c | 9 ++------ hw/core/qdev-properties.c | 34 +++++++++++++++++++++--------- hw/ide/qdev.c | 5 ++++- hw/scsi/scsi-disk.c | 10 +++------ hw/usb/dev-storage.c | 5 ++++- tests/qemu-iotests/172.out | 2 +- 11 files changed, 91 insertions(+), 36 deletions(-) -- 2.26.2