]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
qcow2: Get the request alignment for encrypted images from QCryptoBlock
authorAlberto Garcia <berto@igalia.com>
Thu, 11 Oct 2018 10:58:02 +0000 (13:58 +0300)
committerKevin Wolf <kwolf@redhat.com>
Mon, 5 Nov 2018 14:09:54 +0000 (15:09 +0100)
This doesn't have any practical effect at the moment because the
values of BDRV_SECTOR_SIZE, QCRYPTO_BLOCK_LUKS_SECTOR_SIZE and
QCRYPTO_BLOCK_QCOW_SECTOR_SIZE are all the same (512 bytes), but
future encryption methods could have different requirements.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/qcow2.c

index de94b290e699ea282a43ecf2f81ad41b3a0a064b..991d6ac91b16abf9730696bab0dbe3dd215cfe17 100644 (file)
@@ -1677,7 +1677,7 @@ static void qcow2_refresh_limits(BlockDriverState *bs, Error **errp)
 
     if (bs->encrypted) {
         /* Encryption works on a sector granularity */
-        bs->bl.request_alignment = BDRV_SECTOR_SIZE;
+        bs->bl.request_alignment = qcrypto_block_get_sector_size(s->crypto);
     }
     bs->bl.pwrite_zeroes_alignment = s->cluster_size;
     bs->bl.pdiscard_alignment = s->cluster_size;