[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/23] virtio-blk: reject configs with logical block
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 17/23] virtio-blk: reject configs with logical block size > physical block size |
Date: |
Mon, 18 Dec 2017 14:35:24 +0000 |
From: Mark Kanda <address@hidden>
virtio-blk logical block size should never be larger than physical block
size because it doesn't make sense to have such configurations. QEMU doesn't
have a way to effectively express this condition; the best it can do is
report the physical block exponent as 0 - indicating the logical block size
equals the physical block size.
This is identical to commit 3da023b5827543ee4c022986ea2ad9d1274410b2
but applied to virtio-blk (instead of virtio-scsi).
Signed-off-by: Mark Kanda <address@hidden>
Reviewed-by: Konrad Rzeszutek Wilk <address@hidden>
Reviewed-by: Ameya More <address@hidden>
Reviewed-by: Martin K. Petersen <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
hw/block/virtio-blk.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index d8cfdc81f6..58a5def75d 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -948,6 +948,13 @@ static void virtio_blk_device_realize(DeviceState *dev,
Error **errp)
blkconf_blocksizes(&conf->conf);
+ if (conf->conf.logical_block_size >
+ conf->conf.physical_block_size) {
+ error_setg(errp,
+ "logical_block_size > physical_block_size not supported");
+ return;
+ }
+
virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK,
sizeof(struct virtio_blk_config));
--
2.14.3
- [Qemu-devel] [PULL 06/23] qdev: drop unused #include "sysemu/iothread.h", (continued)
- [Qemu-devel] [PULL 06/23] qdev: drop unused #include "sysemu/iothread.h", Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 09/23] block: don't keep AioContext acquired after drive_backup_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 08/23] block: don't keep AioContext acquired after external_snapshot_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 10/23] block: don't keep AioContext acquired after blockdev_backup_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 11/23] block: don't keep AioContext acquired after internal_snapshot_prepare(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 12/23] block: drop unused BlockDirtyBitmapState->aio_context field, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 13/23] iothread: add iothread_by_id() API, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 14/23] blockdev: add x-blockdev-set-iothread testing command, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 15/23] qemu-iotests: add 202 external snapshots IOThread test, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 16/23] virtio-blk: make queue size configurable, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 17/23] virtio-blk: reject configs with logical block size > physical block size,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 18/23] block: avoid recursive AioContext acquire in bdrv_inactivate_all(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 19/23] docs: mark nested AioContext locking as a legacy API, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 20/23] blockdev: add x-blockdev-set-iothread force boolean, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 21/23] iotests: add VM.add_object(), Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 22/23] iothread: fix iothread_stop() race condition, Stefan Hajnoczi, 2017/12/18
- [Qemu-devel] [PULL 23/23] qemu-iotests: add 203 savevm with IOThreads test, Stefan Hajnoczi, 2017/12/18
- Re: [Qemu-devel] [PULL 00/23] Block patches, Peter Maydell, 2017/12/18