From nobody Mon Feb 9 19:05:43 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1541072491631500.13637733496387; Thu, 1 Nov 2018 04:41:31 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A67C83964; Thu, 1 Nov 2018 11:41:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 098845D6B5; Thu, 1 Nov 2018 11:41:26 +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 1E2F9180B5B7; Thu, 1 Nov 2018 11:41:23 +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 wA1BXpvQ021236 for ; Thu, 1 Nov 2018 07:33:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9563F65927; Thu, 1 Nov 2018 11:33:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CD015D9CD; Thu, 1 Nov 2018 11:33:51 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 05B62307EA91; Thu, 1 Nov 2018 11:33:47 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1gIBEO-0000r1-KY; Thu, 01 Nov 2018 14:33:44 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com, Peter Krempa , "Daniel P. Berrange" , Kevin Wolf Date: Thu, 1 Nov 2018 14:32:24 +0300 Message-Id: <1541071944-815582-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1541071944-815582-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1541071944-815582-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 01 Nov 2018 11:33:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 01 Nov 2018 11:33:49 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Denis Lunev , Stefan Hajnoczi , Max Reitz Subject: [libvirt] [PATCH 3/3] qemu: support metadata-cache-size for blockdev 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 01 Nov 2018 11:41:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_block.c | 5 ++++- src/qemu/qemu_domain.c | 1 + src/util/virstoragefile.c | 1 + src/util/virstoragefile.h | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 5321dda..8771cc1 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1322,7 +1322,6 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorageS= ourcePtr src, * 'pass-discard-snapshot' * 'pass-discard-other' * 'overlap-check' - * 'l2-cache-size' * 'l2-cache-entry-size' * 'refcount-cache-size' * 'cache-clean-interval' @@ -1331,6 +1330,10 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorage= SourcePtr src, if (qemuBlockStorageSourceGetFormatQcowGenericProps(src, "qcow2", prop= s) < 0) return -1; =20 + if (src->metadata_cache_size =3D=3D VIR_DOMAIN_DISK_METADATA_CACHE_SIZ= E_MAXIMUM && + virJSONValueObjectAdd(props, "I:l2-cache-size", INT64_MAX, NULL) <= 0) + return -1; + return 0; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 896adf3..f87cfd2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13245,6 +13245,7 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDefPtr= disk, src->iomode =3D disk->iomode; src->cachemode =3D disk->cachemode; src->discard =3D disk->discard; + src->metadata_cache_size =3D disk->metadata_cache_size; =20 if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) src->floppyimg =3D true; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 94c32d8..9089e2f 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2210,6 +2210,7 @@ virStorageSourceCopy(const virStorageSource *src, ret->cachemode =3D src->cachemode; ret->discard =3D src->discard; ret->detect_zeroes =3D src->detect_zeroes; + ret->metadata_cache_size =3D src->metadata_cache_size; =20 /* storage driver metadata are not copied */ ret->drv =3D NULL; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 3ff6c4f..8b57399 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -331,6 +331,7 @@ struct _virStorageSource { int cachemode; /* enum virDomainDiskCache */ int discard; /* enum virDomainDiskDiscard */ int detect_zeroes; /* enum virDomainDiskDetectZeroes */ + int metadata_cache_size; /* enum virDomainDiskImageMetadataCacheSize */ =20 bool floppyimg; /* set to true if the storage source is going to be us= ed as a source for floppy drive */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list