thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
26ba25
From 6067fd2ec96b36cb8cc09dc389f5d49c9549ca73 Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 6 Dec 2018 17:12:32 +0000
26ba25
Subject: [PATCH 07/15] qcow2: Make sizes more humanly readable
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20181206171240.5674-8-kwolf@redhat.com>
26ba25
Patchwork-id: 83286
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 07/15] qcow2: Make sizes more humanly readable
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 b6a95c6d10075bb540ce50198bbe22fc0a4392c7)
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 | 2 +-
26ba25
 block/qcow2.h | 9 +++++----
26ba25
 2 files changed, 6 insertions(+), 5 deletions(-)
26ba25
26ba25
diff --git a/block/qcow2.c b/block/qcow2.c
26ba25
index a0f7234..3859112 100644
26ba25
--- a/block/qcow2.c
26ba25
+++ b/block/qcow2.c
26ba25
@@ -826,7 +826,7 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts,
26ba25
         }
26ba25
     } else {
26ba25
         if (!l2_cache_size_set) {
26ba25
-            *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE,
26ba25
+            *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE,
26ba25
                                  (uint64_t)DEFAULT_L2_CACHE_CLUSTERS
26ba25
                                  * s->cluster_size);
26ba25
         }
26ba25
diff --git a/block/qcow2.h b/block/qcow2.h
26ba25
index 3d92cdb..f73a48a 100644
26ba25
--- a/block/qcow2.h
26ba25
+++ b/block/qcow2.h
26ba25
@@ -27,6 +27,7 @@
26ba25
 
26ba25
 #include "crypto/block.h"
26ba25
 #include "qemu/coroutine.h"
26ba25
+#include "qemu/units.h"
26ba25
 
26ba25
 //#define DEBUG_ALLOC
26ba25
 //#define DEBUG_ALLOC2
26ba25
@@ -43,11 +44,11 @@
26ba25
 
26ba25
 /* 8 MB refcount table is enough for 2 PB images at 64k cluster size
26ba25
  * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
26ba25
-#define QCOW_MAX_REFTABLE_SIZE 0x800000
26ba25
+#define QCOW_MAX_REFTABLE_SIZE S_8MiB
26ba25
 
26ba25
 /* 32 MB L1 table is enough for 2 PB images at 64k cluster size
26ba25
  * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
26ba25
-#define QCOW_MAX_L1_SIZE 0x2000000
26ba25
+#define QCOW_MAX_L1_SIZE S_32MiB
26ba25
 
26ba25
 /* Allow for an average of 1k per snapshot table entry, should be plenty of
26ba25
  * space for snapshot names and IDs */
26ba25
@@ -75,9 +76,9 @@
26ba25
 
26ba25
 /* Whichever is more */
26ba25
 #define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */
26ba25
-#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */
26ba25
+#define DEFAULT_L2_CACHE_SIZE S_1MiB
26ba25
 
26ba25
-#define DEFAULT_CLUSTER_SIZE 65536
26ba25
+#define DEFAULT_CLUSTER_SIZE S_64KiB
26ba25
 
26ba25
 
26ba25
 #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
26ba25
-- 
26ba25
1.8.3.1
26ba25