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