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

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