[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 13/23] qcow2: Make sizes more humanly readable
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 13/23] qcow2: Make sizes more humanly readable |
Date: |
Mon, 1 Oct 2018 19:18:51 +0200 |
From: Leonid Bloch <address@hidden>
Signed-off-by: Leonid Bloch <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/qcow2.h | 9 +++++----
block/qcow2.c | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/block/qcow2.h b/block/qcow2.h
index 81b844e936..a8d6f757b1 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -27,6 +27,7 @@
#include "crypto/block.h"
#include "qemu/coroutine.h"
+#include "qemu/units.h"
//#define DEBUG_ALLOC
//#define DEBUG_ALLOC2
@@ -43,11 +44,11 @@
/* 8 MB refcount table is enough for 2 PB images at 64k cluster size
* (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
-#define QCOW_MAX_REFTABLE_SIZE 0x800000
+#define QCOW_MAX_REFTABLE_SIZE S_8MiB
/* 32 MB L1 table is enough for 2 PB images at 64k cluster size
* (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */
-#define QCOW_MAX_L1_SIZE 0x2000000
+#define QCOW_MAX_L1_SIZE S_32MiB
/* Allow for an average of 1k per snapshot table entry, should be plenty of
* space for snapshot names and IDs */
@@ -75,9 +76,9 @@
/* Whichever is more */
#define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */
-#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */
+#define DEFAULT_L2_CACHE_SIZE S_1MiB
-#define DEFAULT_CLUSTER_SIZE 65536
+#define DEFAULT_CLUSTER_SIZE S_64KiB
#define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
diff --git a/block/qcow2.c b/block/qcow2.c
index c13153735a..d2c07ce9fe 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -830,7 +830,7 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts
*opts,
}
} else {
if (!l2_cache_size_set) {
- *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE,
+ *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE,
(uint64_t)DEFAULT_L2_CACHE_CLUSTERS
* s->cluster_size);
}
--
2.13.6
- [Qemu-block] [PULL 17/23] qcow2: Resize the cache upon image resizing, (continued)
- [Qemu-block] [PULL 17/23] qcow2: Resize the cache upon image resizing, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 20/23] block-backend: Set werror/rerror defaults in blk_new(), Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 21/23] qcow2: Fix cache-clean-interval documentation, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 22/23] test-replication: Lock AioContext around blk_unref(), Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 08/23] file-posix: Forbid trying to change unsupported options during reopen, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 13/23] qcow2: Make sizes more humanly readable,
Kevin Wolf <=
- [Qemu-block] [PULL 18/23] qcow2: Set the default cache-clean-interval to 10 minutes, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 23/23] tests/test-bdrv-drain: Fix too late qemu_event_reset(), Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 14/23] qcow2: Avoid duplication in setting the refcount cache size, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 11/23] qcow2: Options' documentation fixes, Kevin Wolf, 2018/10/01
- [Qemu-block] [PULL 15/23] qcow2: Assign the L2 cache relatively to the image size, Kevin Wolf, 2018/10/01
- Re: [Qemu-block] [PULL 00/23] Block layer patches, Peter Maydell, 2018/10/02