cryptospore / rpms / qemu-kvm

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