1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

storage: Introduce 'extended_l2' feature for storage volume

QCOW2 images now support 'extended_l2' which splits the default clusters
into 32 subcluster allocation units. This allows the allocation units to
be smaller without increasing the size of L2 table too much and thus also
the cache requirements for holding the full L2 table in memory.

Unfortunately it's incompatible with qemu versions older than 5.2 thus
can't be used as default.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-12-14 16:05:09 +01:00
parent 14584c665e
commit 66566e84b8
8 changed files with 30 additions and 1 deletions

View File

@ -652,6 +652,7 @@ host filesystem. It can contain the following child elements:
<clusterSize unit='KiB'>64</clusterSize>
<features>
<lazy_refcounts/>
<extended_l2/>
</features>
</target>
@ -714,6 +715,9 @@ host filesystem. It can contain the following child elements:
- ``<lazy_refcounts/>`` - allow delayed reference counter updates.
:since:`Since 1.1.0`
- ``<extended_l2/>`` - enables subcluster allocation for qcow2 images. QCOW2
clusters are split into 32 subclusters decreasing the size of L2 cache
needed. It's recommended to increase ``clusterSize``.
Backing store elements
~~~~~~~~~~~~~~~~~~~~~~

View File

@ -134,6 +134,11 @@
<empty/>
</element>
</optional>
<optional>
<element name="extended_l2">
<empty/>
</element>
</optional>
</interleave>
</element>
</define>

View File

@ -66,6 +66,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
VIR_ENUM_IMPL(virStorageFileFeature,
VIR_STORAGE_FILE_FEATURE_LAST,
"lazy_refcounts",
"extended_l2",
);

View File

@ -86,6 +86,7 @@ VIR_ENUM_DECL(virStorageFileFormat);
typedef enum {
VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS = 0,
VIR_STORAGE_FILE_FEATURE_EXTENDED_L2,
VIR_STORAGE_FILE_FEATURE_LAST
} virStorageFileFeature;

View File

@ -796,6 +796,17 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionInfoDef *encinfo,
}
virBufferAddLit(&buf, "lazy_refcounts,");
}
if (virBitmapIsBitSet(info->features,
VIR_STORAGE_FILE_FEATURE_EXTENDED_L2)) {
if (STREQ_NULLABLE(info->compat, "0.10")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("'extended_l2' not supported with compat level %s"),
info->compat);
return -1;
}
virBufferAddLit(&buf, "extended_l2=on,");
}
}
virBufferTrim(&buf, ",");

View File

@ -1,6 +1,6 @@
qemu-img \
create \
-f qcow2 \
-o compat=0.10,cluster_size=131072 \
-o compat=1.1,cluster_size=131072,extended_l2=on \
/var/lib/libvirt/images/OtherDemo.img \
5242880K

View File

@ -13,5 +13,8 @@
<label>unconfined_u:object_r:virt_image_t:s0</label>
</permissions>
<clusterSize unit='KiB'>128</clusterSize>
<features>
<extended_l2/>
</features>
</target>
</volume>

View File

@ -12,6 +12,10 @@
<group>0</group>
<label>unconfined_u:object_r:virt_image_t:s0</label>
</permissions>
<compat>1.1</compat>
<clusterSize unit='B'>131072</clusterSize>
<features>
<extended_l2/>
</features>
</target>
</volume>