qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Leonid Bloch <lbloch@janustech.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
	Max Reitz <mreitz@redhat.com>, Eric Blake <eblake@redhat.com>,
	Alberto Garcia <berto@igalia.com>,
	Leonid Bloch <lbloch@janustech.com>
Subject: [Qemu-devel] [PATCH v7 3/9] qcow2: Make sizes more humanly readable
Date: Fri, 10 Aug 2018 09:26:41 +0300	[thread overview]
Message-ID: <20180810062647.23211-4-lbloch@janustech.com> (raw)
In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com>

Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
 block/qcow2.c | 2 +-
 block/qcow2.h | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index 3f4abc394e..7a2d7a1d48 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -831,7 +831,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);
         }
diff --git a/block/qcow2.h b/block/qcow2.h
index 81b844e936..39e1b279f8 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 (8 * MiB)
 
 /* 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 (32 * MiB)
 
 /* 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 (1 * MiB)
 
-#define DEFAULT_CLUSTER_SIZE 65536
+#define DEFAULT_CLUSTER_SIZE (64 * KiB)
 
 
 #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
-- 
2.17.1

  parent reply	other threads:[~2018-08-10  6:27 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  6:26 [Qemu-devel] [PATCH v7 0/9] Take the image size into account when allocating the L2 cache Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 1/9] qcow2: Options' documentation fixes Leonid Bloch
2018-08-10 11:50   ` Alberto Garcia
2018-08-11 18:01     ` Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 2/9] qcow2: Cosmetic changes Leonid Bloch
2018-08-10 12:54   ` Alberto Garcia
2018-08-10  6:26 ` Leonid Bloch [this message]
2018-08-10  8:33   ` [Qemu-devel] [PATCH v7 3/9] qcow2: Make sizes more humanly readable Alberto Garcia
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 4/9] qcow2: Avoid duplication in setting the refcount cache size Leonid Bloch
2018-08-10 13:14   ` Alberto Garcia
2018-08-11 18:40     ` Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 5/9] qcow2: Assign the L2 cache relatively to the image size Leonid Bloch
2018-08-10 14:39   ` Alberto Garcia
2018-08-11 19:19     ` Leonid Bloch
2018-08-13 11:33       ` Kevin Wolf
2018-08-13 11:48         ` Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 6/9] qcow2: Increase the default upper limit on the L2 cache size Leonid Bloch
2018-08-10 12:00   ` Alberto Garcia
2018-08-13  1:39     ` Max Reitz
2018-08-13  6:09       ` Leonid Bloch
2018-08-13 15:16         ` Max Reitz
2018-08-13 16:00           ` Kevin Wolf
2018-08-13 11:23       ` Kevin Wolf
2018-08-13 15:11         ` Max Reitz
2018-08-13 15:58           ` Kevin Wolf
2018-08-13 16:08             ` Max Reitz
2018-08-13 16:24               ` Kevin Wolf
2018-08-13 16:42             ` Leonid Bloch
2018-08-14  8:18               ` Kevin Wolf
2018-08-14 11:34                 ` Leonid Bloch
2018-08-14 11:44                   ` Kevin Wolf
2018-08-14 12:29                     ` Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 7/9] qcow2: Resize the cache upon image resizing Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 8/9] qcow2: Set the default cache-clean-interval to 10 minutes Leonid Bloch
2018-08-10  6:26 ` [Qemu-devel] [PATCH v7 9/9] qcow2: Explicit number replaced by a constant Leonid Bloch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180810062647.23211-4-lbloch@janustech.com \
    --to=lbloch@janustech.com \
    --cc=berto@igalia.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).