[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded val
From: |
Kevin Wolf |
Subject: |
Re: [PATCH 3/3] qcow2: Use BDRV_SECTOR_SIZE instead of the hardcoded value |
Date: |
Thu, 9 Jan 2020 13:19:00 +0100 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
Am 08.01.2020 um 18:49 hat Alberto Garcia geschrieben:
> This replaces all remaining instances in the qcow2 code.
>
> Signed-off-by: Alberto Garcia <address@hidden>
> diff --git a/block/qcow2.c b/block/qcow2.c
> index e8ce966f7f..6427c75409 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -2175,7 +2175,7 @@ static coroutine_fn int
> qcow2_co_preadv_task(BlockDriverState *bs,
> offset, bytes, qiov, qiov_offset);
>
> case QCOW2_CLUSTER_NORMAL:
> - if ((file_cluster_offset & 511) != 0) {
> + if ((file_cluster_offset % BDRV_SECTOR_SIZE) != 0) {
> return -EIO;
> }
Hm, unrelated to your change, but why do we test for 512 byte alignment
here? file_cluster_offset should certainly be cluster aligned for normal
clusters. And if the check fails, that's actually an image corruption
and not just an I/O error. Am I missing something?
Kevin