From nobody Sat Feb 7 06:54:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639753510; cv=none; d=zohomail.com; s=zohoarc; b=ekB9q9AQwFzmR6GB7ReJZhO+68uCN3cAb+wXtX0675cmTkJZdC8bc7Ykg4kwZZtwbA8vh7EjjcVwhocG1PP3fvYsNUSG4aD6uTC+XAR6jrPU39DWu4PUpIAYUt198jEGelk5IKmT7Ez8Qa4GWP4BWC6QfHl+gFO3Cr181EsRhrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639753510; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1VdUv0H4YB/raJQzB8ck5X0bLGQFTocS6j2K0fHI9Zw=; b=ZNlMrcgF9gBlQ/yXfPSarfNdcWffBiTeq0pwPl4FZcbXUKQIJIWk9ozZDi/SuM5j8gaxx+h02bp7pvSnMnUjyHIen0hU/jsbsPjmpJeQ1f8h6oQWDWX9J5iyqPnCHHVc1HAeR453VmDyVcteTj4QKyYXXduiXLhE9fHfMoWZZNI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1639753510570100.91613617247356; Fri, 17 Dec 2021 07:05:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-245-BXE5TRMJPRux4j1fwXhoDg-1; Fri, 17 Dec 2021 10:05:06 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F375E80417F; Fri, 17 Dec 2021 15:04:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C60E554510; Fri, 17 Dec 2021 15:04:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 82EE24A7CB; Fri, 17 Dec 2021 15:04:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BHF4uQr025192 for ; Fri, 17 Dec 2021 10:04:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 03CD65ED40; Fri, 17 Dec 2021 15:04:56 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FB8A78A9E for ; Fri, 17 Dec 2021 15:04:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639753509; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1VdUv0H4YB/raJQzB8ck5X0bLGQFTocS6j2K0fHI9Zw=; b=XJU/O7Ow9oG72XKOL1rFTH3LTbLS9M1DEQSkJ/dSGNAIo/+Yyee1QZsupOvBPEN5otHH+r x/gI09XqyyBYovJXAcbNGA+EZ7Ys8JOAitIk+AhYHiV2eJ1iwW12dfW62HhM6SRoddKdcD ihVX6p5B75in9yy+80Mq6bI6rFQwzeI= X-MC-Unique: BXE5TRMJPRux4j1fwXhoDg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/7] storage: Introduce 'extended_l2' feature for storage volume Date: Fri, 17 Dec 2021 16:04:30 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639753511172100003 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: J=C3=A1n Tomko --- docs/formatstorage.rst | 4 ++++ docs/schemas/storagecommon.rng | 5 +++++ src/conf/storage_source_conf.c | 1 + src/conf/storage_source_conf.h | 1 + src/storage/storage_util.c | 11 +++++++++++ tests/storagevolxml2argvdata/qcow2-clusterSize.argv | 2 +- tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml | 3 +++ tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml | 4 ++++ 8 files changed, 30 insertions(+), 1 deletion(-) diff --git a/docs/formatstorage.rst b/docs/formatstorage.rst index ae700fef4d..838b00de75 100644 --- a/docs/formatstorage.rst +++ b/docs/formatstorage.rst @@ -646,6 +646,7 @@ host filesystem. It can contain the following child ele= ments: 64 + @@ -708,6 +709,9 @@ host filesystem. It can contain the following child ele= ments: - ```` - allow delayed reference counter updates. :since:`Since 1.1.0` + - ```` - 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 ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng index 591a158209..10f1bc6a15 100644 --- a/docs/schemas/storagecommon.rng +++ b/docs/schemas/storagecommon.rng @@ -134,6 +134,11 @@ + + + + + diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index c0acee189a..d42f715f26 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -66,6 +66,7 @@ VIR_ENUM_IMPL(virStorageFileFormat, VIR_ENUM_IMPL(virStorageFileFeature, VIR_STORAGE_FILE_FEATURE_LAST, "lazy_refcounts", + "extended_l2", ); diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index 40db29c418..c4a026881c 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -86,6 +86,7 @@ VIR_ENUM_DECL(virStorageFileFormat); typedef enum { VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS =3D 0, + VIR_STORAGE_FILE_FEATURE_EXTENDED_L2, VIR_STORAGE_FILE_FEATURE_LAST } virStorageFileFeature; diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index bfc3edb1fd..03874d6ca3 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -796,6 +796,17 @@ storageBackendCreateQemuImgOpts(virStorageEncryptionIn= foDef *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=3Don,"); + } } virBufferTrim(&buf, ","); diff --git a/tests/storagevolxml2argvdata/qcow2-clusterSize.argv b/tests/st= oragevolxml2argvdata/qcow2-clusterSize.argv index 8878a26818..c84fc8c47a 100644 --- a/tests/storagevolxml2argvdata/qcow2-clusterSize.argv +++ b/tests/storagevolxml2argvdata/qcow2-clusterSize.argv @@ -1,6 +1,6 @@ qemu-img \ create \ -f qcow2 \ --o compat=3D0.10,cluster_size=3D131072 \ +-o compat=3D1.1,cluster_size=3D131072,extended_l2=3Don \ /var/lib/libvirt/images/OtherDemo.img \ 5242880K diff --git a/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml b/tests/st= oragevolxml2xmlin/vol-qcow2-clusterSize.xml index 22534982a1..2152a1f280 100644 --- a/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml +++ b/tests/storagevolxml2xmlin/vol-qcow2-clusterSize.xml @@ -13,5 +13,8 @@ 128 + + + diff --git a/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml b/tests/s= toragevolxml2xmlout/vol-qcow2-clusterSize.xml index 393a492536..40acb21ff8 100644 --- a/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml +++ b/tests/storagevolxml2xmlout/vol-qcow2-clusterSize.xml @@ -12,6 +12,10 @@ 0 + 1.1 131072 + + + --=20 2.31.1