[libvirt] [PATCH 3/3] qemu: support metadata-cache-size for blockdev

Kevin Wolf kwolf at redhat.com
Fri Nov 2 10:23:39 UTC 2018


Am 01.11.2018 um 12:32 hat Nikolay Shirokovskiy geschrieben:
> Just set l2-cache-size to INT64_MAX for all format nodes of
> qcow2 type in block node graph.
> 
> AFAIK this is sane because *actual* cache size depends on size
> of data being referenced in image and thus the total size of
> all cache sizes for all images in disk backing chain will not
> exceed the cache size that covers just one full image as in
> case of no backing chain.

This is not quite correct.

Starting from qemu 3.1, INT64_MAX will add a cache that covers the whole
image. Memory is only used if a cache entry is actually used, so if you
never access the backing file, it doesn't really use any memory.
However, the granularity isn't a single cluster here, but L2 tables. So
if some L2 table contains one cluster in the overlay and another cluster
in the backing file, and both are accessed, the L2 table will be cached
in both the overlay and th backing file.

More importantly, before 3.1, I think QEMU will actually try to allocate
2^63-1 bytes for the cache and fail to open the image. So we can't do
this unconditionally.

(Is this patch tested with a real QEMU?)

Kevin




More information about the libvir-list mailing list