* [Qemu-devel] [PATCH v2 1/5] qcow2: Options' documentation fixes
2018-08-07 20:21 [Qemu-devel] [PATCH v2 0/5] qcow2: Make the L2 cache cover the whole image by default Leonid Bloch
@ 2018-08-07 20:21 ` Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 2/5] qcow2: Make the default L2 cache sufficient to cover the entire image Leonid Bloch
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Leonid Bloch @ 2018-08-07 20:21 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Kevin Wolf, Max Reitz, Eric Blake, Alberto Garcia,
Leonid Bloch
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
docs/qcow2-cache.txt | 3 +++
qemu-options.hx | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
index 8a09a5cc5f..5bf2a8ad29 100644
--- a/docs/qcow2-cache.txt
+++ b/docs/qcow2-cache.txt
@@ -130,6 +130,9 @@ There are a few things that need to be taken into account:
memory as possible to the L2 cache before increasing the refcount
cache size.
+ - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size"
+ can be set simultaneously.
+
Unlike L2 tables, refcount blocks are not used during normal I/O but
only during allocations and internal snapshots. In most cases they are
accessed sequentially (even during random guest I/O) so increasing the
diff --git a/qemu-options.hx b/qemu-options.hx
index b1bf0f485f..f6804758d3 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -752,15 +752,18 @@ image file)
@item cache-size
The maximum total size of the L2 table and refcount block caches in bytes
-(default: 1048576 bytes or 8 clusters, whichever is larger)
+(default: the sum of l2-cache-size and refcount-cache-size)
@item l2-cache-size
The maximum size of the L2 table cache in bytes
-(default: 4/5 of the total cache size)
+(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever
+is larger; otherwise, as large as possible or needed within the cache-size,
+while permitting the requested or the minimal refcount cache size)
@item refcount-cache-size
The maximum size of the refcount block cache in bytes
-(default: 1/5 of the total cache size)
+(default: 4 times the cluster size; or if cache-size is specified, the part of
+it which is not used for the L2 cache)
@item cache-clean-interval
Clean unused entries in the L2 and refcount caches. The interval is in seconds.
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 2/5] qcow2: Make the default L2 cache sufficient to cover the entire image
2018-08-07 20:21 [Qemu-devel] [PATCH v2 0/5] qcow2: Make the L2 cache cover the whole image by default Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 1/5] qcow2: Options' documentation fixes Leonid Bloch
@ 2018-08-07 20:21 ` Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 3/5] qcow2: Resize the cache upon image resizing Leonid Bloch
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Leonid Bloch @ 2018-08-07 20:21 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Kevin Wolf, Max Reitz, Eric Blake, Alberto Garcia,
Leonid Bloch
Sufficient L2 cache can noticeably improve the performance when using
large images with frequent I/O. The memory overhead is not significant
in most cases, as the cache size is only 1 MB for each 8 GB of virtual
image size (with the default cluster size of 64 KB). For cases with very
large images and/or small cluster sizes, there is an upper limit on the
default L2 cache: 32 MB. To modify this limit one can use the already
existing 'l2-cache-size' option. This option was previously documented
as the *maximum* L2 cache size, and this patch makes it behave as such,
instead of a constant size. Also, the existing option 'cache-size' can
limit the sum of both L2 and refcount caches, as previously.
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
block/qcow2.c | 33 +++++++++++++--------------------
block/qcow2.h | 4 +---
docs/qcow2-cache.txt | 24 ++++++++++++++----------
qemu-options.hx | 6 +++---
tests/qemu-iotests/137 | 1 -
tests/qemu-iotests/137.out | 1 -
6 files changed, 31 insertions(+), 38 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index ec9e6238a0..98cb96aaca 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -777,29 +777,35 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts,
uint64_t *refcount_cache_size, Error **errp)
{
BDRVQcow2State *s = bs->opaque;
- uint64_t combined_cache_size;
+ uint64_t combined_cache_size, l2_cache_max_setting;
bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_set;
- int min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size;
+ uint64_t min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size;
combined_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE);
l2_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE);
refcount_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE);
combined_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_CACHE_SIZE, 0);
- *l2_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, 0);
+ l2_cache_max_setting = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE,
+ DEFAULT_L2_CACHE_MAX_SIZE);
*refcount_cache_size = qemu_opt_get_size(opts,
QCOW2_OPT_REFCOUNT_CACHE_SIZE, 0);
*l2_cache_entry_size = qemu_opt_get_size(
opts, QCOW2_OPT_L2_CACHE_ENTRY_SIZE, s->cluster_size);
+ uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE;
+ uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8);
+ *l2_cache_size = MIN(max_l2_cache, l2_cache_max_setting);
+
if (combined_cache_size_set) {
if (l2_cache_size_set && refcount_cache_size_set) {
error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_SIZE
" and " QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not be set "
"at the same time");
return;
- } else if (*l2_cache_size > combined_cache_size) {
+ } else if (l2_cache_size_set &&
+ (l2_cache_max_setting > combined_cache_size)) {
error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed "
QCOW2_OPT_CACHE_SIZE);
return;
@@ -814,29 +820,16 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts,
} else if (refcount_cache_size_set) {
*l2_cache_size = combined_cache_size - *refcount_cache_size;
} else {
- uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE;
- uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8);
-
/* Assign as much memory as possible to the L2 cache, and
* use the remainder for the refcount cache */
- if (combined_cache_size >= max_l2_cache + min_refcount_cache) {
- *l2_cache_size = max_l2_cache;
+ if (combined_cache_size >= *l2_cache_size + min_refcount_cache) {
*refcount_cache_size = combined_cache_size - *l2_cache_size;
} else {
- *refcount_cache_size =
- MIN(combined_cache_size, min_refcount_cache);
+ *refcount_cache_size = MIN(combined_cache_size,
+ min_refcount_cache);
*l2_cache_size = combined_cache_size - *refcount_cache_size;
}
}
- } else {
- if (!l2_cache_size_set) {
- *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE,
- (uint64_t)DEFAULT_L2_CACHE_CLUSTERS
- * s->cluster_size);
- }
- if (!refcount_cache_size_set) {
- *refcount_cache_size = min_refcount_cache;
- }
}
if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) ||
diff --git a/block/qcow2.h b/block/qcow2.h
index 81b844e936..d77a31d932 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -73,9 +73,7 @@
/* Must be at least 4 to cover all cases of refcount table growth */
#define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */
-/* Whichever is more */
-#define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */
-#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */
+#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U /* bytes */
#define DEFAULT_CLUSTER_SIZE 65536
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
index 5bf2a8ad29..c7625cdeb3 100644
--- a/docs/qcow2-cache.txt
+++ b/docs/qcow2-cache.txt
@@ -97,12 +97,14 @@ need:
l2_cache_size = disk_size_GB * 131072
refcount_cache_size = disk_size_GB * 32768
-QEMU has a default L2 cache of 1MB (1048576 bytes) and a refcount
-cache of 256KB (262144 bytes), so using the formulas we've just seen
-we have
+QEMU will use a default L2 cache sufficient to cover the entire virtual
+size of an image, which with the default cluster size will result in 1 MB
+of cache for every 8 GB of virtual image size:
- 1048576 / 131072 = 8 GB of virtual disk covered by that cache
- 262144 / 32768 = 8 GB
+ 65536 / 8 = 8192 = 8 GB / 1 MB
+
+A default refcount cache is 4 times the cluster size, which defaults to
+256 KB (262144 bytes).
How to configure the cache sizes
@@ -121,8 +123,11 @@ There are a few things that need to be taken into account:
- Both caches must have a size that is a multiple of the cluster size
(or the cache entry size: see "Using smaller cache sizes" below).
- - The default L2 cache size is 8 clusters or 1MB (whichever is more),
- and the minimum is 2 clusters (or 2 cache entries, see below).
+ - The default L2 cache size will cover the entire virtual size of an
+ image, but is capped at 32 MB (enough for image sizes of up to 256 GB
+ with the default cluster size). This maximum value can be reduced or
+ enlarged using the "l2-cache-size" option. The minimum is 2 clusters
+ (or 2 cache entries, see below).
- The default (and minimum) refcount cache size is 4 clusters.
@@ -180,9 +185,8 @@ Some things to take into account:
always uses the cluster size as the entry size.
- If the L2 cache is big enough to hold all of the image's L2 tables
- (as explained in the "Choosing the right cache sizes" section
- earlier in this document) then none of this is necessary and you
- can omit the "l2-cache-entry-size" parameter altogether.
+ (the default behavior) then none of this is necessary and you can
+ omit the "l2-cache-entry-size" parameter altogether.
Reducing the memory usage
diff --git a/qemu-options.hx b/qemu-options.hx
index f6804758d3..d6e15b2f06 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -756,9 +756,9 @@ The maximum total size of the L2 table and refcount block caches in bytes
@item l2-cache-size
The maximum size of the L2 table cache in bytes
-(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever
-is larger; otherwise, as large as possible or needed within the cache-size,
-while permitting the requested or the minimal refcount cache size)
+(default: if cache-size is not defined - 32M; otherwise, as large as possible
+or needed within the cache-size, while permitting the requested or the minimal
+refcount cache size)
@item refcount-cache-size
The maximum size of the refcount block cache in bytes
diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
index 87965625d8..e3fb078588 100755
--- a/tests/qemu-iotests/137
+++ b/tests/qemu-iotests/137
@@ -109,7 +109,6 @@ $QEMU_IO \
-c "reopen -o cache-size=1M,l2-cache-size=64k,refcount-cache-size=64k" \
-c "reopen -o cache-size=1M,l2-cache-size=2M" \
-c "reopen -o cache-size=1M,refcount-cache-size=2M" \
- -c "reopen -o l2-cache-size=256T" \
-c "reopen -o l2-cache-entry-size=33k" \
-c "reopen -o l2-cache-entry-size=128k" \
-c "reopen -o refcount-cache-size=256T" \
diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out
index 6a2ffc71fd..70f245ae7a 100644
--- a/tests/qemu-iotests/137.out
+++ b/tests/qemu-iotests/137.out
@@ -19,7 +19,6 @@ Parameter 'lazy-refcounts' expects 'on' or 'off'
cache-size, l2-cache-size and refcount-cache-size may not be set at the same time
l2-cache-size may not exceed cache-size
refcount-cache-size may not exceed cache-size
-L2 cache size too big
L2 cache entry size must be a power of two between 512 and the cluster size (65536)
L2 cache entry size must be a power of two between 512 and the cluster size (65536)
Refcount cache size too big
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 3/5] qcow2: Resize the cache upon image resizing
2018-08-07 20:21 [Qemu-devel] [PATCH v2 0/5] qcow2: Make the L2 cache cover the whole image by default Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 1/5] qcow2: Options' documentation fixes Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 2/5] qcow2: Make the default L2 cache sufficient to cover the entire image Leonid Bloch
@ 2018-08-07 20:21 ` Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 4/5] qcow2: Set the default cache-clean-interval to 30 seconds Leonid Bloch
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 5/5] qcow2: Explicit number replaced by a constant Leonid Bloch
4 siblings, 0 replies; 8+ messages in thread
From: Leonid Bloch @ 2018-08-07 20:21 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Kevin Wolf, Max Reitz, Eric Blake, Alberto Garcia,
Leonid Bloch
The caches are now recalculated upon image resizing. This is done
because the new default behavior of assigning a sufficient L2 cache to
cover the entire image implies that the cache will still be sufficient
after an image resizing.
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
block/qcow2.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index 98cb96aaca..f60cb92169 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -3639,6 +3639,8 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
}
}
+ bs->total_sectors = offset / BDRV_SECTOR_SIZE;
+
/* write updated header.size */
offset = cpu_to_be64(offset);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size),
@@ -3649,6 +3651,12 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
}
s->l1_vm_state_index = new_l1_size;
+ /* Update cache sizes */
+ QDict *options = qdict_clone_shallow(bs->options);
+ ret = qcow2_update_options(bs, options, s->flags, errp);
+ if (ret < 0) {
+ goto fail;
+ }
ret = 0;
fail:
qemu_co_mutex_unlock(&s->lock);
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 4/5] qcow2: Set the default cache-clean-interval to 30 seconds
2018-08-07 20:21 [Qemu-devel] [PATCH v2 0/5] qcow2: Make the L2 cache cover the whole image by default Leonid Bloch
` (2 preceding siblings ...)
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 3/5] qcow2: Resize the cache upon image resizing Leonid Bloch
@ 2018-08-07 20:21 ` Leonid Bloch
2018-08-07 20:34 ` Eric Blake
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 5/5] qcow2: Explicit number replaced by a constant Leonid Bloch
4 siblings, 1 reply; 8+ messages in thread
From: Leonid Bloch @ 2018-08-07 20:21 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Kevin Wolf, Max Reitz, Eric Blake, Alberto Garcia,
Leonid Bloch
The default cache-clean-interval is set to 30 seconds, in order to lower
the overhead of the qcow2 caches.
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
block/qcow2.c | 2 +-
block/qcow2.h | 1 +
docs/qcow2-cache.txt | 3 +--
qapi/block-core.json | 3 ++-
qemu-options.hx | 2 +-
5 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index f60cb92169..453a6377ac 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -941,7 +941,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs,
/* New interval for cache cleanup timer */
r->cache_clean_interval =
qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL,
- s->cache_clean_interval);
+ DEFAULT_CACHE_CLEAN_INTERVAL);
#ifndef CONFIG_LINUX
if (r->cache_clean_interval != 0) {
error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL
diff --git a/block/qcow2.h b/block/qcow2.h
index d77a31d932..96a2808685 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -77,6 +77,7 @@
#define DEFAULT_CLUSTER_SIZE 65536
+#define DEFAULT_CACHE_CLEAN_INTERVAL 30 /* seconds */
#define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"
#define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request"
diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt
index c7625cdeb3..1e6711a63a 100644
--- a/docs/qcow2-cache.txt
+++ b/docs/qcow2-cache.txt
@@ -202,8 +202,7 @@ This example removes all unused cache entries every 15 minutes:
-drive file=hd.qcow2,cache-clean-interval=900
-If unset, the default value for this parameter is 0 and it disables
-this feature.
+If unset, the default value for this parameter is 30.
Note that this functionality currently relies on the MADV_DONTNEED
argument for madvise() to actually free the memory. This is a
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 5b9084a394..4d8fca9128 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -2830,7 +2830,8 @@
#
# @cache-clean-interval: clean unused entries in the L2 and refcount
# caches. The interval is in seconds. The default value
-# is 0 and it disables this feature (since 2.5)
+# is 30. (since 2.5)
+#
# @encrypt: Image decryption options. Mandatory for
# encrypted images, except when doing a metadata-only
# probe of the image. (since 2.10)
diff --git a/qemu-options.hx b/qemu-options.hx
index d6e15b2f06..0cda3d3c3a 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -767,7 +767,7 @@ it which is not used for the L2 cache)
@item cache-clean-interval
Clean unused entries in the L2 and refcount caches. The interval is in seconds.
-The default value is 0 and it disables this feature.
+The default value is 30.
@item pass-discard-request
Whether discard requests to the qcow2 device should be forwarded to the data
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 4/5] qcow2: Set the default cache-clean-interval to 30 seconds
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 4/5] qcow2: Set the default cache-clean-interval to 30 seconds Leonid Bloch
@ 2018-08-07 20:34 ` Eric Blake
2018-08-08 6:23 ` Leonid Bloch
0 siblings, 1 reply; 8+ messages in thread
From: Eric Blake @ 2018-08-07 20:34 UTC (permalink / raw)
To: Leonid Bloch, qemu-devel
Cc: qemu-block, Kevin Wolf, Max Reitz, Alberto Garcia
On 08/07/2018 03:21 PM, Leonid Bloch wrote:
> The default cache-clean-interval is set to 30 seconds, in order to lower
> the overhead of the qcow2 caches.
>
> Signed-off-by: Leonid Bloch <lbloch@janustech.com>
> ---
> +++ b/qapi/block-core.json
> @@ -2830,7 +2830,8 @@
> #
> # @cache-clean-interval: clean unused entries in the L2 and refcount
> # caches. The interval is in seconds. The default value
> -# is 0 and it disables this feature (since 2.5)
> +# is 30. (since 2.5)
> +#
> # @encrypt: Image decryption options. Mandatory for
> # encrypted images, except when doing a metadata-only
> # probe of the image. (since 2.10)
> diff --git a/qemu-options.hx b/qemu-options.hx
> index d6e15b2f06..0cda3d3c3a 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -767,7 +767,7 @@ it which is not used for the L2 cache)
>
> @item cache-clean-interval
> Clean unused entries in the L2 and refcount caches. The interval is in seconds.
> -The default value is 0 and it disables this feature.
> +The default value is 30.
May be worth wording as:
The default value is 30, while setting it to 0 disables this feature.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH v2 4/5] qcow2: Set the default cache-clean-interval to 30 seconds
2018-08-07 20:34 ` Eric Blake
@ 2018-08-08 6:23 ` Leonid Bloch
0 siblings, 0 replies; 8+ messages in thread
From: Leonid Bloch @ 2018-08-08 6:23 UTC (permalink / raw)
To: Eric Blake, qemu-devel; +Cc: qemu-block, Kevin Wolf, Max Reitz, Alberto Garcia
On 08/07/2018 11:34 PM, Eric Blake wrote:
> On 08/07/2018 03:21 PM, Leonid Bloch wrote:
>> The default cache-clean-interval is set to 30 seconds, in order to lower
>> the overhead of the qcow2 caches.
>>
>> Signed-off-by: Leonid Bloch <lbloch@janustech.com>
>> ---
>
>> +++ b/qapi/block-core.json
>> @@ -2830,7 +2830,8 @@
>> #
>> # @cache-clean-interval: clean unused entries in the L2 and refcount
>> # caches. The interval is in seconds. The
>> default value
>> -# is 0 and it disables this feature (since 2.5)
>> +# is 30. (since 2.5)
>> +#
>> # @encrypt: Image decryption options. Mandatory for
>> # encrypted images, except when doing a
>> metadata-only
>> # probe of the image. (since 2.10)
>> diff --git a/qemu-options.hx b/qemu-options.hx
>> index d6e15b2f06..0cda3d3c3a 100644
>> --- a/qemu-options.hx
>> +++ b/qemu-options.hx
>> @@ -767,7 +767,7 @@ it which is not used for the L2 cache)
>> @item cache-clean-interval
>> Clean unused entries in the L2 and refcount caches. The interval is
>> in seconds.
>> -The default value is 0 and it disables this feature.
>> +The default value is 30.
>
> May be worth wording as:
>
> The default value is 30, while setting it to 0 disables this feature.
>
Definitely! Thanks! Will fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH v2 5/5] qcow2: Explicit number replaced by a constant
2018-08-07 20:21 [Qemu-devel] [PATCH v2 0/5] qcow2: Make the L2 cache cover the whole image by default Leonid Bloch
` (3 preceding siblings ...)
2018-08-07 20:21 ` [Qemu-devel] [PATCH v2 4/5] qcow2: Set the default cache-clean-interval to 30 seconds Leonid Bloch
@ 2018-08-07 20:21 ` Leonid Bloch
4 siblings, 0 replies; 8+ messages in thread
From: Leonid Bloch @ 2018-08-07 20:21 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Kevin Wolf, Max Reitz, Eric Blake, Alberto Garcia,
Leonid Bloch
Signed-off-by: Leonid Bloch <lbloch@janustech.com>
---
block/qcow2.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 453a6377ac..a54e20402b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1321,7 +1321,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options,
/* 2^(s->refcount_order - 3) is the refcount width in bytes */
s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3);
s->refcount_block_size = 1 << s->refcount_block_bits;
- bs->total_sectors = header.size / 512;
+ bs->total_sectors = header.size / BDRV_SECTOR_SIZE;
s->csize_shift = (62 - (s->cluster_bits - 8));
s->csize_mask = (1 << (s->cluster_bits - 8)) - 1;
s->cluster_offset_mask = (1LL << s->csize_shift) - 1;
@@ -3446,7 +3446,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,
goto fail;
}
- old_length = bs->total_sectors * 512;
+ old_length = bs->total_sectors * BDRV_SECTOR_SIZE;
new_l1_size = size_to_l1(s, offset);
if (offset < old_length) {
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread