Blame SOURCES/kvm-qcow2-Set-the-default-cache-clean-interval-to-10-min.patch

26ba25
From 5e5ad26daad9372b9276b18c5b773528b8239c31 Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 6 Dec 2018 17:12:37 +0000
26ba25
Subject: [PATCH 12/15] qcow2: Set the default cache-clean-interval to 10
26ba25
 minutes
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20181206171240.5674-13-kwolf@redhat.com>
26ba25
Patchwork-id: 83288
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 12/15] qcow2: Set the default cache-clean-interval to 10 minutes
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
The default cache-clean-interval is set to 10 minutes, in order to lower
26ba25
the overhead of the qcow2 caches (before the default was 0, i.e.
26ba25
disabled).
26ba25
26ba25
* For non-Linux platforms the default is kept at 0, because
26ba25
  cache-clean-interval is not supported there yet.
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 e957b50b8daecfc39a1ac09855b0eacb6edfd328)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block/qcow2.c        | 2 +-
26ba25
 block/qcow2.h        | 4 +++-
26ba25
 docs/qcow2-cache.txt | 4 ++--
26ba25
 qapi/block-core.json | 3 ++-
26ba25
 qemu-options.hx      | 2 +-
26ba25
 5 files changed, 9 insertions(+), 6 deletions(-)
26ba25
26ba25
diff --git a/block/qcow2.c b/block/qcow2.c
26ba25
index 72f1ea8..acd076c 100644
26ba25
--- a/block/qcow2.c
26ba25
+++ b/block/qcow2.c
26ba25
@@ -940,7 +940,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs,
26ba25
     /* New interval for cache cleanup timer */
26ba25
     r->cache_clean_interval =
26ba25
         qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL,
26ba25
-                            s->cache_clean_interval);
26ba25
+                            DEFAULT_CACHE_CLEAN_INTERVAL);
26ba25
 #ifndef CONFIG_LINUX
26ba25
     if (r->cache_clean_interval != 0) {
26ba25
         error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL
26ba25
diff --git a/block/qcow2.h b/block/qcow2.h
26ba25
index 6c6c742..29b041c 100644
26ba25
--- a/block/qcow2.h
26ba25
+++ b/block/qcow2.h
26ba25
@@ -76,13 +76,15 @@
26ba25
 
26ba25
 #ifdef CONFIG_LINUX
26ba25
 #define DEFAULT_L2_CACHE_MAX_SIZE S_32MiB
26ba25
+#define DEFAULT_CACHE_CLEAN_INTERVAL 600  /* seconds */
26ba25
 #else
26ba25
 #define DEFAULT_L2_CACHE_MAX_SIZE S_8MiB
26ba25
+/* Cache clean interval is currently available only on Linux, so must be 0 */
26ba25
+#define DEFAULT_CACHE_CLEAN_INTERVAL 0
26ba25
 #endif
26ba25
 
26ba25
 #define DEFAULT_CLUSTER_SIZE S_64KiB
26ba25
 
26ba25
-
26ba25
 #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
26ba25
 #define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request"
26ba25
 #define QCOW2_OPT_DISCARD_SNAPSHOT "pass-discard-snapshot"
26ba25
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
26ba25
index 1fcc065..59358b8 100644
26ba25
--- a/docs/qcow2-cache.txt
26ba25
+++ b/docs/qcow2-cache.txt
26ba25
@@ -210,8 +210,8 @@ This example removes all unused cache entries every 15 minutes:
26ba25
 
26ba25
    -drive file=hd.qcow2,cache-clean-interval=900
26ba25
 
26ba25
-If unset, the default value for this parameter is 0 and it disables
26ba25
-this feature.
26ba25
+If unset, the default value for this parameter is 600. Setting it to 0
26ba25
+disables this feature.
26ba25
 
26ba25
 Note that this functionality currently relies on the MADV_DONTNEED
26ba25
 argument for madvise() to actually free the memory. This is a
26ba25
diff --git a/qapi/block-core.json b/qapi/block-core.json
26ba25
index a6c3977..5318c9b 100644
26ba25
--- a/qapi/block-core.json
26ba25
+++ b/qapi/block-core.json
26ba25
@@ -2867,7 +2867,8 @@
26ba25
 #
26ba25
 # @cache-clean-interval:  clean unused entries in the L2 and refcount
26ba25
 #                         caches. The interval is in seconds. The default value
26ba25
-#                         is 0 and it disables this feature (since 2.5)
26ba25
+#                         is 600, and 0 disables this feature. (since 2.5)
26ba25
+#
26ba25
 # @encrypt:               Image decryption options. Mandatory for
26ba25
 #                         encrypted images, except when doing a metadata-only
26ba25
 #                         probe of the image. (since 2.10)
26ba25
diff --git a/qemu-options.hx b/qemu-options.hx
26ba25
index e3f4e43..05fabf3 100644
26ba25
--- a/qemu-options.hx
26ba25
+++ b/qemu-options.hx
26ba25
@@ -767,7 +767,7 @@ 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
-The default value is 0 and it disables this feature.
26ba25
+The default value is 600. Setting it to 0 disables this feature.
26ba25
 
26ba25
 @item pass-discard-request
26ba25
 Whether discard requests to the qcow2 device should be forwarded to the data
26ba25
-- 
26ba25
1.8.3.1
26ba25