aboutsummaryrefslogtreecommitdiff
path: root/block/cloop.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:17 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:25 +0200
commita65064816d64db463f4c24bd81dcaad62fee89eb (patch)
tree4cd8ced0f63203a99b49bca6eaf8145f864660cf /block/cloop.c
parent2914a1de992118286f5280eddf4f4e6060a8e00b (diff)
downloadqemu-a65064816d64db463f4c24bd81dcaad62fee89eb.zip
qemu-a65064816d64db463f4c24bd81dcaad62fee89eb.tar.gz
qemu-a65064816d64db463f4c24bd81dcaad62fee89eb.tar.bz2
block: Set request_alignment during .bdrv_refresh_limits()
We want to eventually stick request_alignment alongside other BlockLimits, but first, we must ensure it is populated at the same time as all other limits, rather than being a special case that is set only when a block is first opened. Add a .bdrv_refresh_limits() to all four of our legacy devices that will always be sector-only (bochs, cloop, dmg, vvfat), in spite of their recent conversion to expose a byte interface. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/cloop.c')
-rw-r--r--block/cloop.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/cloop.c b/block/cloop.c
index ea5a92b..d574003 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -67,7 +67,6 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
int ret;
bs->read_only = 1;
- bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
/* read header */
ret = bdrv_pread(bs->file->bs, 128, &s->block_size, 4);
@@ -199,6 +198,11 @@ fail:
return ret;
}
+static void cloop_refresh_limits(BlockDriverState *bs, Error **errp)
+{
+ bs->request_alignment = BDRV_SECTOR_SIZE; /* No sub-sector I/O supported */
+}
+
static inline int cloop_read_block(BlockDriverState *bs, int block_num)
{
BDRVCloopState *s = bs->opaque;
@@ -280,6 +284,7 @@ static BlockDriver bdrv_cloop = {
.instance_size = sizeof(BDRVCloopState),
.bdrv_probe = cloop_probe,
.bdrv_open = cloop_open,
+ .bdrv_refresh_limits = cloop_refresh_limits,
.bdrv_co_preadv = cloop_co_preadv,
.bdrv_close = cloop_close,
};