|
|
7711c0 |
From 4ae8e237a43188fd01c057a336d06942a53bc04f Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Date: Tue, 19 Feb 2019 17:00:14 +0100
|
|
|
7711c0 |
Subject: [PATCH 13/23] qcow2: Options' documentation fixes
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Message-id: <20190219170023.27826-5-kwolf@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84544
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 04/13] qcow2: Options' documentation fixes
|
|
|
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 40fb215d483ce510e211b843352288894eb13285)
|
|
|
7711c0 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
docs/qcow2-cache.txt | 21 ++++++++++++++-------
|
|
|
7711c0 |
qemu-options.hx | 9 ++++++---
|
|
|
7711c0 |
2 files changed, 20 insertions(+), 10 deletions(-)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
|
|
|
7711c0 |
index 8a09a5c..7e28b41 100644
|
|
|
7711c0 |
--- a/docs/qcow2-cache.txt
|
|
|
7711c0 |
+++ b/docs/qcow2-cache.txt
|
|
|
7711c0 |
@@ -79,14 +79,14 @@ Choosing the right cache sizes
|
|
|
7711c0 |
In order to choose the cache sizes we need to know how they relate to
|
|
|
7711c0 |
the amount of allocated space.
|
|
|
7711c0 |
|
|
|
7711c0 |
-The amount of virtual disk that can be mapped by the L2 and refcount
|
|
|
7711c0 |
+The part of the virtual disk that can be mapped by the L2 and refcount
|
|
|
7711c0 |
caches (in bytes) is:
|
|
|
7711c0 |
|
|
|
7711c0 |
disk_size = l2_cache_size * cluster_size / 8
|
|
|
7711c0 |
disk_size = refcount_cache_size * cluster_size * 8 / refcount_bits
|
|
|
7711c0 |
|
|
|
7711c0 |
With the default values for cluster_size (64KB) and refcount_bits
|
|
|
7711c0 |
-(16), that is
|
|
|
7711c0 |
+(16), this becomes:
|
|
|
7711c0 |
|
|
|
7711c0 |
disk_size = l2_cache_size * 8192
|
|
|
7711c0 |
disk_size = refcount_cache_size * 32768
|
|
|
7711c0 |
@@ -97,12 +97,16 @@ need:
|
|
|
7711c0 |
l2_cache_size = disk_size_GB * 131072
|
|
|
7711c0 |
refcount_cache_size = disk_size_GB * 32768
|
|
|
7711c0 |
|
|
|
7711c0 |
-QEMU has a default L2 cache of 1MB (1048576 bytes) and a refcount
|
|
|
7711c0 |
-cache of 256KB (262144 bytes), so using the formulas we've just seen
|
|
|
7711c0 |
-we have
|
|
|
7711c0 |
+For example, 1MB of L2 cache is needed to cover every 8 GB of the virtual
|
|
|
7711c0 |
+image size (given that the default cluster size is used):
|
|
|
7711c0 |
|
|
|
7711c0 |
- 1048576 / 131072 = 8 GB of virtual disk covered by that cache
|
|
|
7711c0 |
- 262144 / 32768 = 8 GB
|
|
|
7711c0 |
+ 8 GB / 8192 = 1 MB
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+The refcount cache is 4 times the cluster size by default. With the default
|
|
|
7711c0 |
+cluster size of 64 KB, it is 256 KB (262144 bytes). This is sufficient for
|
|
|
7711c0 |
+8 GB of image size:
|
|
|
7711c0 |
+
|
|
|
7711c0 |
+ 262144 * 32768 = 8 GB
|
|
|
7711c0 |
|
|
|
7711c0 |
|
|
|
7711c0 |
How to configure the cache sizes
|
|
|
7711c0 |
@@ -130,6 +134,9 @@ There are a few things that need to be taken into account:
|
|
|
7711c0 |
memory as possible to the L2 cache before increasing the refcount
|
|
|
7711c0 |
cache size.
|
|
|
7711c0 |
|
|
|
7711c0 |
+ - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size"
|
|
|
7711c0 |
+ can be set simultaneously.
|
|
|
7711c0 |
+
|
|
|
7711c0 |
Unlike L2 tables, refcount blocks are not used during normal I/O but
|
|
|
7711c0 |
only during allocations and internal snapshots. In most cases they are
|
|
|
7711c0 |
accessed sequentially (even during random guest I/O) so increasing the
|
|
|
7711c0 |
diff --git a/qemu-options.hx b/qemu-options.hx
|
|
|
7711c0 |
index 5c58760..3308b94 100644
|
|
|
7711c0 |
--- a/qemu-options.hx
|
|
|
7711c0 |
+++ b/qemu-options.hx
|
|
|
7711c0 |
@@ -752,15 +752,18 @@ image file)
|
|
|
7711c0 |
|
|
|
7711c0 |
@item cache-size
|
|
|
7711c0 |
The maximum total size of the L2 table and refcount block caches in bytes
|
|
|
7711c0 |
-(default: 1048576 bytes or 8 clusters, whichever is larger)
|
|
|
7711c0 |
+(default: the sum of l2-cache-size and refcount-cache-size)
|
|
|
7711c0 |
|
|
|
7711c0 |
@item l2-cache-size
|
|
|
7711c0 |
The maximum size of the L2 table cache in bytes
|
|
|
7711c0 |
-(default: 4/5 of the total cache size)
|
|
|
7711c0 |
+(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever
|
|
|
7711c0 |
+is larger; otherwise, as large as possible or needed within the cache-size,
|
|
|
7711c0 |
+while permitting the requested or the minimal refcount cache size)
|
|
|
7711c0 |
|
|
|
7711c0 |
@item refcount-cache-size
|
|
|
7711c0 |
The maximum size of the refcount block cache in bytes
|
|
|
7711c0 |
-(default: 1/5 of the total cache size)
|
|
|
7711c0 |
+(default: 4 times the cluster size; or if cache-size is specified, the part of
|
|
|
7711c0 |
+it which is not used for the L2 cache)
|
|
|
7711c0 |
|
|
|
7711c0 |
@item cache-clean-interval
|
|
|
7711c0 |
Clean unused entries in the L2 and refcount caches. The interval is in seconds.
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|