[PATCH 5/5] qemu: Implement '<metadata_cache><max_size>' control for qcow2

Ján Tomko jtomko at redhat.com
Thu Jan 7 20:49:27 UTC 2021


On a Thursday in 2021, Peter Krempa wrote:
>qemu's qcow2 driver allows control of the metadata cache of qcow2 driver
>by the 'cache-size' property. Wire it up to the recently introduced
>elements.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_block.c                         | 11 ++++
> src/qemu/qemu_domain.c                        | 15 +++++
> src/qemu/qemu_snapshot.c                      | 14 +++++
> .../disk-metadata-cache.x86_64-latest.args    | 57 +++++++++++++++++++
> tests/qemuxml2argvtest.c                      |  1 +
> 5 files changed, 98 insertions(+)
> create mode 100644 tests/qemuxml2argvdata/disk-metadata-cache.x86_64-latest.args
>
>diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
>index 4640e339c0..857c5aa8d0 100644
>--- a/src/qemu/qemu_block.c
>+++ b/src/qemu/qemu_block.c
>@@ -1343,6 +1343,17 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorageSourcePtr src,
>     if (qemuBlockStorageSourceGetFormatQcowGenericProps(src, "qcow2", props) < 0)
>         return -1;
>
>+    /* 'cache-size' controls the maximum size of l2 and refcount caches.

s/l2/L2/

>+     * see: qemu.git/docs/qcow2-cache.txt
>+     * https://git.qemu.org/?p=qemu.git;a=blob;f=docs/qcow2-cache.txt
>+     */
>+    if (src->metadataCacheMaxSize > 0) {
>+        if (virJSONValueObjectAdd(props,
>+                                  "U:cache-size", src->metadataCacheMaxSize,
>+                                  NULL) < 0)
>+            return -1;
>+    }
>+
>     return 0;
> }
>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210107/fd97c9d6/attachment-0001.sig>


More information about the libvir-list mailing list