diff options
author | Roman Kagan <rvkagan@yandex-team.ru> | 2020-05-29 01:55:10 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-06-17 14:53:40 +0200 |
commit | c56ee92fcba8cc922b1b2188ac20614d20223db2 (patch) | |
tree | 5790ad5e71f651f85db76f612e39d2270b6510c3 /hw/usb/dev-storage.c | |
parent | 6abee2608563599f783bf1305a8322ee7b447815 (diff) | |
download | qemu-c56ee92fcba8cc922b1b2188ac20614d20223db2.zip |
block: consolidate blocksize properties consistency checks
Several block device properties related to blocksize configuration must
be in certain relationship WRT each other: physical block must be no
smaller than logical block; min_io_size, opt_io_size, and
discard_granularity must be a multiple of a logical block.
To ensure these requirements are met, add corresponding consistency
checks to blkconf_blocksizes, adjusting its signature to communicate
possible error to the caller. Also remove the now redundant consistency
checks from the specific devices.
Signed-off-by: Roman Kagan <rvkagan@yandex-team.ru>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <20200528225516.1676602-3-rvkagan@yandex-team.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/usb/dev-storage.c')
-rw-r--r-- | hw/usb/dev-storage.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index a5204b6f2a..f5977eb72e 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -612,7 +612,10 @@ static void usb_msd_storage_realize(USBDevice *dev, Error **errp) return; } - blkconf_blocksizes(&s->conf); + if (!blkconf_blocksizes(&s->conf, errp)) { + return; + } + if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), true, errp)) { return; |