]> Git Repo - qemu.git/blobdiff - block/qcow2.c
block: Move request_alignment into BlockLimit
[qemu.git] / block / qcow2.c
index 23f666d4aeb29775ec13e2eeb3633501c46d70a4..fdf13cb7813e85273b96025d6204285c360f40ad 100644 (file)
@@ -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->bl.request_alignment = BDRV_SECTOR_SIZE;
+    }
     bs->bl.pwrite_zeroes_alignment = s->cluster_size;
 }
 
This page took 0.025308 seconds and 4 git commands to generate.