From e0ee7e18ae8fb3430202de49faa34091359ef675 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Thu, 6 Dec 2018 17:12:38 +0000 Subject: [PATCH 13/15] qcow2: Explicit number replaced by a constant RH-Author: Kevin Wolf Message-id: <20181206171240.5674-14-kwolf@redhat.com> Patchwork-id: 83292 O-Subject: [RHEL-8.0 qemu-kvm PATCH 13/15] qcow2: Explicit number replaced by a constant Bugzilla: 1656507 RH-Acked-by: Max Reitz RH-Acked-by: John Snow RH-Acked-by: Stefan Hajnoczi From: Leonid Bloch Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia Reviewed-by: Kevin Wolf Signed-off-by: Kevin Wolf (cherry picked from commit bd016b912cc68c6f6c68cd5acb2e13126bd9e05c) Signed-off-by: Kevin Wolf Signed-off-by: Danilo C. L. de Paula --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index acd076c..114dcdd 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1321,7 +1321,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, /* 2^(s->refcount_order - 3) is the refcount width in bytes */ s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; - bs->total_sectors = header.size / 512; + bs->total_sectors = header.size / BDRV_SECTOR_SIZE; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; @@ -3494,7 +3494,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, goto fail; } - old_length = bs->total_sectors * 512; + old_length = bs->total_sectors * BDRV_SECTOR_SIZE; new_l1_size = size_to_l1(s, offset); if (offset < old_length) { -- 1.8.3.1