qcow2: Take the image size into account when allocating the L2 cache
v6 cover qcow2: Take the image size into account when allocating the L2 cache
This series makes the qcow2 L2 cache assignment aware of the image size, with the intention for it to cover the entire image. The importance of this change is in noticeable performance improvement, especially with heavy random I/O. The memory overhead is not big in most cases, as only 1 MB of cache for every 8 GB of image size is used. For cases with very large images and/or small cluster sizes, or systems with limited RAM resources, 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' and 'cache-size' options. Moreover, this fixes the behavior of 'l2-cache-size', as it was documented as the *maximum* L2 cache size, but in practice behaved as the absolute size.
To compensate the memory overhead which may be increased following this behavior, the default cache-clean-interval is set to 10 minutes by default (was disabled by default before).
The L2 cache is also resized accordingly, by default, if the image is resized.
Additionally, few minor changes are made (refactoring and documentation fixes).
Differences from v1:
* .gitignore modification patch removed (unneeded).
* The grammar fix in conflicting cache sizing patch removed (merged).
* The update total_sectors when resizing patch squashed with the resizing patch.
* L2 cache is now capped at 32 MB.
* The default cache-clean-interval is set to 30 seconds.
Differences from v2:
* Made it clear in the documentation that setting cache-clean-interval to 0 disables this feature.
Differences from v3:
* The default cache-clean-interval is set to 10 minutes instead of 30 seconds before.
* Commit message changes to better explain the patches.
* Some refactoring.
Differences from v4:
* Refactoring.
* Documentation and commit message fixes.
Differences from v5:
* A patch with cosmetic changes is split from the main patch
* A patch for avoiding duplication in refcount cache size assignment is split from the main patch.
* In the main patch the cap on the L2 cache size is set to only 1 MB (in order to be close to the previous behavior) and a separate patch sets it to 32 MB.
* Changes in the documentation fixes patch [1/8].
Leonid Bloch (8):
qcow2: Options' documentation fixes
qcow2: Cosmetic changes
qcow2: Avoid duplication in setting the refcount cache size
qcow2: Assign the L2 cache relatively to the image size
qcow2: Increase the default upper limit on the L2 cache size
qcow2: Resize the cache upon image resizing
qcow2: Set the default cache-clean-interval to 10 minutes
qcow2: Explicit number replaced by a constant
block/qcow2.c | 54 +++++++++++++++++++++----------------- block/qcow2.h | 5 ++-- docs/qcow2-cache.txt | 33 ++++++++++++++--------- qapi/block-core.json | 3 ++- qemu-options.hx | 11 +++++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 7 files changed, 62 insertions(+), 46 deletions(-)
Signature · 1 line
2.17.1
PATCH v6 1/8 qcow2: Options' documentation fixes
--- docs/qcow2-cache.txt | 16 +++++++++++----- qemu-options.hx | 9 ++++++--- 2 files changed, 17 insertions(+), 8 deletions(-)
docs/qcow2-cache.txt +11 -5
@@ -97,12 +97,15 @@ 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 +With the default cluster size, to cover each 8 GB of the virtual image +size, 1MB of L2 cache is needed: - 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). This is sufficient for 8 GB of image size: + + 262144 / 32768 = 8 GB How to configure the cache sizes
@@ -130,6 +133,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
qemu-options.hx +6 -3
@@ -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.
Signature · 1 line
2.17.1
PATCH v6 2/8 qcow2: Cosmetic changes
In reply to Leonid BlochSome refactoring for better readability is done here.
--- block/qcow2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
block/qcow2.c +5 -4
@@ -790,8 +790,9 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *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); + *l2_cache_entry_size =qemu_opt_get_size (opts, +QCOW2_OPT_L2_CACHE_ENTRY_SIZE , + s->cluster_size);if (combined_cache_size_set) {if (l2_cache_size_set && refcount_cache_size_set) {
@@ -823,8 +824,8 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *l2_cache_size = max_l2_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; } }
Signature · 1 line
2.17.1
PATCH v6 3/8 qcow2: Avoid duplication in setting the refcount cache size
In reply to Leonid BlochThe refcount cache size does not need to be set to its minimum value in read_cache_sizes(), as it is set to at least its minimum value in qcow2_update_options_prepare().
--- block/qcow2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
block/qcow2.c +6 -9
@@ -829,16 +829,13 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *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; - } + }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 is not specified, it will be set to minimum +* in qcow2_update_options_prepare(). No need to set it here. */ if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) || *l2_cache_entry_size > s->cluster_size ||
Signature · 1 line
2.17.1
PATCH v6 4/8 qcow2: Assign the L2 cache relatively to the image size
In reply to Leonid BlochSufficient L2 cache can noticeably improve the performance when using large images with frequent I/O.
Previously, the L2 cache was allocated without considering the image size, and an option existed to manually determine its size. Thus to achieve a full coverage of an image by the L2 cache (i.e. use more than the default value of MAX(1 MB, 8 clusters)), a user needed to calculate the required size manually, or with a script, and pass this value to the 'l2-cache-size' option.
Now, the L2 cache is assigned taking the actual image size into account, and will cover the entire image, unless the size needed for that is larger than a certain maximum. This maximum is set to 1 MB by default (enough to cover an 8 GB image with the default cluster size) but can be increased or decreased using the '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 as a constant size. Also, the existing option 'cache-size' can limit the sum of both L2 and refcount caches, as previously.
--- block/qcow2.c | 22 ++++++++++------------ block/qcow2.h | 4 +--- docs/qcow2-cache.txt | 13 ++++++++----- qemu-options.hx | 6 +++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 6 files changed, 22 insertions(+), 25 deletions(-)
block/qcow2.c +10 -12
@@ -777,16 +777,19 @@ 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 virtual_disk_size = bs->total_sectors *BDRV_SECTOR_SIZE ; +uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size /8 ); 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 );
@@ -794,13 +797,16 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts,QCOW2_OPT_L2_CACHE_ENTRY_SIZE , s->cluster_size); + *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 ;
@@ -815,13 +821,9 @@ 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,
@@ -829,10 +831,6 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *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 is not specified, it will be set to minimum * in qcow2_update_options_prepare(). No need to set it here. */
block/qcow2.h +1 -3
@@ -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 1048576/* bytes */ #define DEFAULT_CLUSTER_SIZE 65536
docs/qcow2-cache.txt +8 -5
@@ -124,8 +124,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, up to a certain maximum. This maximum is 1 MB by default + (enough for image sizes of up to 8 GB with the default cluster size) + and it 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.
@@ -183,9 +186,9 @@ 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 for images of up to 8 GB in size) then none + of this is necessary and you can omit the "l2-cache-entry-size" + parameter altogether. Reducing the memory usage
qemu-options.hx +3 -3
@@ -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 specified - 1M; otherwise, as large as possible +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
tests/qemu-iotests/137 +0 -1
@@ -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" \
tests/qemu-iotests/137.out +0 -1
@@ -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
Signature · 1 line
2.17.1
PATCH v6 5/8 qcow2: Increase the default upper limit on the L2 cache size
In reply to Leonid BlochThe upper limit on the L2 cache size is increased from 1 MB to 32 MB. This is done in order to allow default full coverage of an image with the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that only the needed amount to cover the full image is allocated. The value which is changed here is just the upper limit on the L2 cache size, beyond which it will not grow, even if the size of the image requires it to.
--- block/qcow2.h | 2 +- docs/qcow2-cache.txt | 6 +++--- qemu-options.hx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
block/qcow2.h +1 -1
@@ -73,7 +73,7 @@/* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4/* clusters */ -#define DEFAULT_L2_CACHE_MAX_SIZE 1048576/* bytes */ +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U/* bytes */ #define DEFAULT_CLUSTER_SIZE 65536
docs/qcow2-cache.txt +3 -3
@@ -125,8 +125,8 @@ There are a few things that need to be taken into account: (or the cache entry size: see "Using smaller cache sizes" below). - The default L2 cache size will cover the entire virtual size of an - image, up to a certain maximum. This maximum is 1 MB by default - (enough for image sizes of up to 8 GB with the default cluster size) + image, up to a certain maximum. This maximum is 32 MB by default + (enough for image sizes of up to 256 GB with the default cluster size) and it can be reduced or enlarged using the "l2-cache-size" option. The minimum is 2 clusters (or 2 cache entries, see below).
@@ -186,7 +186,7 @@ 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 - (the default behavior for images of up to 8 GB in size) then none + (the default behavior for images of up to 256 GB in size) then none of this is necessary and you can omit the "l2-cache-entry-size" parameter altogether.
qemu-options.hx +1 -1
@@ -756,7 +756,7 @@ 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 specified - 1M; otherwise, as large as possible +(default: if cache-size is not specified - 32M; otherwise, as large as possible within the cache-size, while permitting the requested or the minimal refcount cache size)
Signature · 1 line
2.17.1
Re: [Qemu-devel] [PATCH v6 5/8] qcow2: Increase the default upper limit on the L2 cache size
Quoted 20 lines · Leonid Bloch
The upper limit on the L2 cache size is increased from 1 MB to 32 MB. This is done in order to allow default full coverage of an image with the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that only the needed amount to cover the full image is allocated. The value which is changed here is just the upper limit on the L2 cache size, beyond which it will not grow, even if the size of the image requires it to.
Signed-off-by Leonid Bloch <[email protected]>--- block/qcow2.h | 2 +- docs/qcow2-cache.txt | 6 +++--- qemu-options.hx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)block/qcow2.h +0
-0
block/qcow2.h line 76
Quoted 5 lines
block/qcow2.h +1
-1@@ -73,7 +73,7 @@/* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4/* clusters */ -#define DEFAULT_L2_CACHE_MAX_SIZE 1048576/* bytes */ +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U/* bytes */
I'd spell this as '(64 * MiB)' with the help of "qemu/units.h".
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Re: [Qemu-devel] [PATCH v6 5/8] qcow2: Increase the default upper limit on the L2 cache size
Quoted 10 lines
block/qcow2.h line 75
Quoted 7 lines
block/qcow2.h +1
-1@@ -73,7 +73,7 @@ /* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ -#define DEFAULT_L2_CACHE_MAX_SIZE 1048576/* bytes */ +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U/* bytes */ I'd spell this as '(64 * MiB)' with the help of "
qemu/units.h".
You mean '(32 * MiB)', right? Good idea! Done.
Leonid.
PATCH v6 6/8 qcow2: Resize the cache upon image resizing
In reply to Leonid BlochThe caches are now recalculated upon image resizing. This is done because the new default behavior of assigning L2 cache relatively to the image size, implies that the cache will be adapted accordingly after an image resize.
--- block/qcow2.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
block/qcow2.c +10 -0
@@ -3418,6 +3418,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset,uint64_t old_length;int64_t new_l1_size;int ret; +QDict *options;if (prealloc !=PREALLOC_MODE_OFF && prealloc !=PREALLOC_MODE_METADATA && prealloc !=PREALLOC_MODE_FALLOC && prealloc !=PREALLOC_MODE_FULL )
@@ -3642,6 +3643,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),
@@ -3652,6 +3655,13 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + +/* Update cache sizes */ + 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);
Signature · 1 line
2.17.1
PATCH v6 7/8 qcow2: Set the default cache-clean-interval to 10 minutes
In reply to Leonid BlochThe default cache-clean-interval is set to 10 minutes, in order to lower the overhead of the qcow2 caches (before the default was 0, i.e. disabled).
--- block/qcow2.c | 2 +- block/qcow2.h | 1 + docs/qcow2-cache.txt | 4 ++-- qapi/block-core.json | 3 ++- qemu-options.hx | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-)
block/qcow2.c +1 -1
@@ -944,7 +944,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
block/qcow2.h +1 -0
@@ -77,6 +77,7 @@#define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CACHE_CLEAN_INTERVAL 600/* seconds */ #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"#define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request"
docs/qcow2-cache.txt +2 -2
@@ -204,8 +204,8 @@ 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 600. Setting it to 0 +disables this feature. Note that this functionality currently relies on the MADV_DONTNEED argument for madvise() to actually free the memory. This is a
qapi/block-core.json +2 -1
@@ -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 600, and 0 disables this feature. (since 2.5) +# # @encrypt: Image decryption options. Mandatory for # encrypted images, except when doing a metadata-only # probe of the image. (since 2.10)
qemu-options.hx +1 -1
@@ -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 600. Setting it to 0 disables this feature. @item pass-discard-request Whether discard requests to the qcow2 device should be forwarded to the data
Signature · 1 line
2.17.1
PATCH v6 8/8 qcow2: Explicit number replaced by a constant
In reply to Leonid Bloch--- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/qcow2.c +2 -2
@@ -1324,7 +1324,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 ;
@@ -3450,7 +3450,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) {
Signature · 1 line
2.17.1