[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH v3 11/22] qcow2: Set request_alignment during .bdrv_
From: |
Eric Blake |
Subject: |
[Qemu-block] [PATCH v3 11/22] qcow2: Set request_alignment during .bdrv_refresh_limits() |
Date: |
Thu, 23 Jun 2016 16:37:15 -0600 |
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 <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
---
v3: no change
v2: new patch
---
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;
}
--
2.5.5
- [Qemu-block] [PATCH v3 10/22] iscsi: Set request_alignment during .bdrv_refresh_limits(), (continued)
- [Qemu-block] [PATCH v3 10/22] iscsi: Set request_alignment during .bdrv_refresh_limits(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 08/22] block: Give nonzero result to blk_get_max_transfer_length(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 05/22] nbd: Advertise realistic limits to block layer, Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 01/22] block: Tighter assertions on bdrv_aligned_pwritev(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 02/22] block: Document supported flags during bdrv_aligned_preadv(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 03/22] block: Fix harmless off-by-one in bdrv_aligned_preadv(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 14/22] block: Set default request_alignment during bdrv_refresh_limits(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 07/22] scsi: Advertise limits by blocksize, not 512, Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 11/22] qcow2: Set request_alignment during .bdrv_refresh_limits(),
Eric Blake <=
- [Qemu-block] [PATCH v3 12/22] raw-win32: Set request_alignment during .bdrv_refresh_limits(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 21/22] block: Fix error message style, Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 13/22] block: Set request_alignment during .bdrv_refresh_limits(), Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 16/22] block: Wording tweaks to write zeroes limits, Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 15/22] block: Switch transfer length bounds to byte-based, Eric Blake, 2016/06/23
- [Qemu-block] [PATCH v3 20/22] block: Move request_alignment into BlockLimit, Eric Blake, 2016/06/23