From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSdG-0000vT-4h for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSdB-0006XO-W8 for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:51:29 -0400 From: Kevin Wolf Date: Tue, 5 Jul 2016 17:50:21 +0200 Message-Id: <1467733852-27097-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1467733852-27097-1-git-send-email-kwolf@redhat.com> References: <1467733852-27097-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 12/43] qcow2: Set request_alignment during .bdrv_refresh_limits() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Eric Blake 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 Reviewed-by: Kevin Wolf Reviewed-by: Fam Zheng Signed-off-by: Kevin Wolf --- block/qcow2.c | 7 ++++--- 1 file 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; } -- 1.8.3.1