cryptospore / rpms / qemu-kvm

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