|
|
ae23c9 |
From a608710425e4de7446a0ca5591f00751af971b0a Mon Sep 17 00:00:00 2001
|
|
|
ae23c9 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Date: Thu, 6 Dec 2018 17:12:30 +0000
|
|
|
ae23c9 |
Subject: [PATCH 05/15] qcow2: Options' documentation fixes
|
|
|
ae23c9 |
|
|
|
ae23c9 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Message-id: <20181206171240.5674-6-kwolf@redhat.com>
|
|
|
ae23c9 |
Patchwork-id: 83285
|
|
|
ae23c9 |
O-Subject: [RHEL-8.0 qemu-kvm PATCH 05/15] qcow2: Options' documentation fixes
|
|
|
ae23c9 |
Bugzilla: 1656507
|
|
|
ae23c9 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
ae23c9 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
From: Leonid Bloch <lbloch@janustech.com>
|
|
|
ae23c9 |
|
|
|
ae23c9 |
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
|
|
|
ae23c9 |
Reviewed-by: Alberto Garcia <berto@igalia.com>
|
|
|
ae23c9 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
(cherry picked from commit 40fb215d483ce510e211b843352288894eb13285)
|
|
|
ae23c9 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ae23c9 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ae23c9 |
---
|
|
|
ae23c9 |
docs/qcow2-cache.txt | 21 ++++++++++++++-------
|
|
|
ae23c9 |
qemu-options.hx | 9 ++++++---
|
|
|
ae23c9 |
2 files changed, 20 insertions(+), 10 deletions(-)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
|
|
|
ae23c9 |
index 8a09a5c..7e28b41 100644
|
|
|
ae23c9 |
--- a/docs/qcow2-cache.txt
|
|
|
ae23c9 |
+++ b/docs/qcow2-cache.txt
|
|
|
ae23c9 |
@@ -79,14 +79,14 @@ Choosing the right cache sizes
|
|
|
ae23c9 |
In order to choose the cache sizes we need to know how they relate to
|
|
|
ae23c9 |
the amount of allocated space.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
-The amount of virtual disk that can be mapped by the L2 and refcount
|
|
|
ae23c9 |
+The part of the virtual disk that can be mapped by the L2 and refcount
|
|
|
ae23c9 |
caches (in bytes) is:
|
|
|
ae23c9 |
|
|
|
ae23c9 |
disk_size = l2_cache_size * cluster_size / 8
|
|
|
ae23c9 |
disk_size = refcount_cache_size * cluster_size * 8 / refcount_bits
|
|
|
ae23c9 |
|
|
|
ae23c9 |
With the default values for cluster_size (64KB) and refcount_bits
|
|
|
ae23c9 |
-(16), that is
|
|
|
ae23c9 |
+(16), this becomes:
|
|
|
ae23c9 |
|
|
|
ae23c9 |
disk_size = l2_cache_size * 8192
|
|
|
ae23c9 |
disk_size = refcount_cache_size * 32768
|
|
|
ae23c9 |
@@ -97,12 +97,16 @@ need:
|
|
|
ae23c9 |
l2_cache_size = disk_size_GB * 131072
|
|
|
ae23c9 |
refcount_cache_size = disk_size_GB * 32768
|
|
|
ae23c9 |
|
|
|
ae23c9 |
-QEMU has a default L2 cache of 1MB (1048576 bytes) and a refcount
|
|
|
ae23c9 |
-cache of 256KB (262144 bytes), so using the formulas we've just seen
|
|
|
ae23c9 |
-we have
|
|
|
ae23c9 |
+For example, 1MB of L2 cache is needed to cover every 8 GB of the virtual
|
|
|
ae23c9 |
+image size (given that the default cluster size is used):
|
|
|
ae23c9 |
|
|
|
ae23c9 |
- 1048576 / 131072 = 8 GB of virtual disk covered by that cache
|
|
|
ae23c9 |
- 262144 / 32768 = 8 GB
|
|
|
ae23c9 |
+ 8 GB / 8192 = 1 MB
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+The refcount cache is 4 times the cluster size by default. With the default
|
|
|
ae23c9 |
+cluster size of 64 KB, it is 256 KB (262144 bytes). This is sufficient for
|
|
|
ae23c9 |
+8 GB of image size:
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
+ 262144 * 32768 = 8 GB
|
|
|
ae23c9 |
|
|
|
ae23c9 |
|
|
|
ae23c9 |
How to configure the cache sizes
|
|
|
ae23c9 |
@@ -130,6 +134,9 @@ There are a few things that need to be taken into account:
|
|
|
ae23c9 |
memory as possible to the L2 cache before increasing the refcount
|
|
|
ae23c9 |
cache size.
|
|
|
ae23c9 |
|
|
|
ae23c9 |
+ - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size"
|
|
|
ae23c9 |
+ can be set simultaneously.
|
|
|
ae23c9 |
+
|
|
|
ae23c9 |
Unlike L2 tables, refcount blocks are not used during normal I/O but
|
|
|
ae23c9 |
only during allocations and internal snapshots. In most cases they are
|
|
|
ae23c9 |
accessed sequentially (even during random guest I/O) so increasing the
|
|
|
ae23c9 |
diff --git a/qemu-options.hx b/qemu-options.hx
|
|
|
ae23c9 |
index 2e05112..5e15d6f 100644
|
|
|
ae23c9 |
--- a/qemu-options.hx
|
|
|
ae23c9 |
+++ b/qemu-options.hx
|
|
|
ae23c9 |
@@ -752,15 +752,18 @@ image file)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@item cache-size
|
|
|
ae23c9 |
The maximum total size of the L2 table and refcount block caches in bytes
|
|
|
ae23c9 |
-(default: 1048576 bytes or 8 clusters, whichever is larger)
|
|
|
ae23c9 |
+(default: the sum of l2-cache-size and refcount-cache-size)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@item l2-cache-size
|
|
|
ae23c9 |
The maximum size of the L2 table cache in bytes
|
|
|
ae23c9 |
-(default: 4/5 of the total cache size)
|
|
|
ae23c9 |
+(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever
|
|
|
ae23c9 |
+is larger; otherwise, as large as possible or needed within the cache-size,
|
|
|
ae23c9 |
+while permitting the requested or the minimal refcount cache size)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@item refcount-cache-size
|
|
|
ae23c9 |
The maximum size of the refcount block cache in bytes
|
|
|
ae23c9 |
-(default: 1/5 of the total cache size)
|
|
|
ae23c9 |
+(default: 4 times the cluster size; or if cache-size is specified, the part of
|
|
|
ae23c9 |
+it which is not used for the L2 cache)
|
|
|
ae23c9 |
|
|
|
ae23c9 |
@item cache-clean-interval
|
|
|
ae23c9 |
Clean unused entries in the L2 and refcount caches. The interval is in seconds.
|
|
|
ae23c9 |
--
|
|
|
ae23c9 |
1.8.3.1
|
|
|
ae23c9 |
|