Blame SOURCES/kvm-qcow2-Make-sizes-more-humanly-readable.patch

7711c0
From 320903cac23bb449df8c2e9cf737e16b3f94d684 Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Tue, 19 Feb 2019 17:00:16 +0100
7711c0
Subject: [PATCH 15/23] qcow2: Make sizes more humanly readable
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20190219170023.27826-7-kwolf@redhat.com>
7711c0
Patchwork-id: 84546
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 06/13] qcow2: Make sizes more humanly readable
7711c0
Bugzilla: 1656913
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
From: Leonid Bloch <lbloch@janustech.com>
7711c0
7711c0
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
7711c0
Reviewed-by: Alberto Garcia <berto@igalia.com>
7711c0
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
(cherry picked from commit b6a95c6d10075bb540ce50198bbe22fc0a4392c7)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block/qcow2.c | 2 +-
7711c0
 block/qcow2.h | 9 +++++----
7711c0
 2 files changed, 6 insertions(+), 5 deletions(-)
7711c0
7711c0
diff --git a/block/qcow2.c b/block/qcow2.c
7711c0
index a0f7234..3859112 100644
7711c0
--- a/block/qcow2.c
7711c0
+++ b/block/qcow2.c
7711c0
@@ -826,7 +826,7 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts,
7711c0
         }
7711c0
     } else {
7711c0
         if (!l2_cache_size_set) {
7711c0
-            *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE,
7711c0
+            *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE,
7711c0
                                  (uint64_t)DEFAULT_L2_CACHE_CLUSTERS
7711c0
                                  * s->cluster_size);
7711c0
         }
7711c0
diff --git a/block/qcow2.h b/block/qcow2.h
7711c0
index 3d92cdb..f73a48a 100644
7711c0
--- a/block/qcow2.h
7711c0
+++ b/block/qcow2.h
7711c0
@@ -27,6 +27,7 @@
7711c0
 
7711c0
 #include "crypto/block.h"
7711c0
 #include "qemu/coroutine.h"
7711c0
+#include "qemu/units.h"
7711c0
 
7711c0
 //#define DEBUG_ALLOC
7711c0
 //#define DEBUG_ALLOC2
7711c0
@@ -43,11 +44,11 @@
7711c0
 
7711c0
 /* 8 MB refcount table is enough for 2 PB images at 64k cluster size
7711c0
  * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
7711c0
-#define QCOW_MAX_REFTABLE_SIZE 0x800000
7711c0
+#define QCOW_MAX_REFTABLE_SIZE S_8MiB
7711c0
 
7711c0
 /* 32 MB L1 table is enough for 2 PB images at 64k cluster size
7711c0
  * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
7711c0
-#define QCOW_MAX_L1_SIZE 0x2000000
7711c0
+#define QCOW_MAX_L1_SIZE S_32MiB
7711c0
 
7711c0
 /* Allow for an average of 1k per snapshot table entry, should be plenty of
7711c0
  * space for snapshot names and IDs */
7711c0
@@ -75,9 +76,9 @@
7711c0
 
7711c0
 /* Whichever is more */
7711c0
 #define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */
7711c0
-#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */
7711c0
+#define DEFAULT_L2_CACHE_SIZE S_1MiB
7711c0
 
7711c0
-#define DEFAULT_CLUSTER_SIZE 65536
7711c0
+#define DEFAULT_CLUSTER_SIZE S_64KiB
7711c0
 
7711c0
 
7711c0
 #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
7711c0
-- 
7711c0
1.8.3.1
7711c0