On Mon 09 Oct 2017 05:07:56 PM CEST, Max Reitz wrote: > On 2017-10-09 16:48, Alberto Garcia wrote: >> BDRV_SECTOR_BITS is defined to be 9 in block.h (and BDRV_SECTOR_SIZE >> is calculated from that), but there are still a few placed where we >> are using the literal value instead of the macro. >> >> Signed-off-by: Alberto Garcia <be...@igalia.com> >> --- >> block/qcow2-cluster.c | 6 +++--- >> block/qcow2.c | 4 ++-- >> 2 files changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c >> index 0e5aec81cb..0a63604af6 100644 >> --- a/block/qcow2-cluster.c >> +++ b/block/qcow2-cluster.c >> @@ -748,8 +748,8 @@ uint64_t >> qcow2_alloc_compressed_cluster_offset(BlockDriverState *bs, >> return 0; >> } >> >> - nb_csectors = ((cluster_offset + compressed_size - 1) >> 9) - >> - (cluster_offset >> 9); >> + nb_csectors = ((cluster_offset + compressed_size - 1) >> >> BDRV_SECTOR_BITS) - >> + (cluster_offset >> BDRV_SECTOR_BITS); > > I'm not sure about this one, because technically this is not the block > layer's sector size but actually 512 bytes ("Compressed size of the > images in sectors of 512 bytes" as per the spec).
You're right, I'll resend the patch leaving this part out for now. Berto