aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:15 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:25 +0200
commita84178ccff77d48261d31a78f1edfc58c9bdaa47 (patch)
treefad3a9f86790b17ee718ae95dea515d76d4af5bc /block/qcow2.c
parentc8b3b998e2bb61e511591f126be9d362d80d705d (diff)
downloadqemu-a84178ccff77d48261d31a78f1edfc58c9bdaa47.zip
qemu-a84178ccff77d48261d31a78f1edfc58c9bdaa47.tar.gz
qemu-a84178ccff77d48261d31a78f1edfc58c9bdaa47.tar.bz2
qcow2: 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. 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/qcow2.c')
-rw-r--r--block/qcow2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index 23f666d..48f80b6 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -981,9 +981,6 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
}
bs->encrypted = 1;
-
- /* Encryption works on a sector granularity */
- bs->request_alignment = BDRV_SECTOR_SIZE;
}
s->l2_bits = s->cluster_bits - 3; /* L2 is always one cluster */
@@ -1202,6 +1199,10 @@ static void qcow2_refresh_limits(BlockDriverState *bs, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
+ if (bs->encrypted) {
+ /* Encryption works on a sector granularity */
+ bs->request_alignment = BDRV_SECTOR_SIZE;
+ }
bs->bl.pwrite_zeroes_alignment = s->cluster_size;
}