From nobody Sun Feb 8 14:08:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1726667064322486.164417119943; Wed, 18 Sep 2024 06:44:24 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 46ACB1C06; Wed, 18 Sep 2024 09:44:23 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 15F7A1B70; Wed, 18 Sep 2024 09:42:23 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EFBCF1B11; Wed, 18 Sep 2024 09:42:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7B3851AD6 for ; Wed, 18 Sep 2024 09:42:12 -0400 (EDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-13-sFddOjMoP-OQkDK--6QN_w-1; Wed, 18 Sep 2024 09:42:11 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42cb22d396cso54278285e9.0 for ; Wed, 18 Sep 2024 06:42:10 -0700 (PDT) Received: from wheatley.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378e73f99ebsm12414107f8f.63.2024.09.18.06.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 06:42:08 -0700 (PDT) Received: from wheatley.brq.redhat.com (wheatley.k8r.cz [127.0.0.1]) by wheatley.localdomain (Postfix) with ESMTP id C605924F687C; Wed, 18 Sep 2024 15:42:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726666932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/hiqPq8RjsrMX+Agw8yMSR6RcXGHPvoGOxB2fMfGo9Q=; b=LAfRL/Kc1QQ8gRefAlGMlPn5LYsSoGLTywP5Q8uTp9ywmeQKgrf4OF8Hl1Si1zdplbu2N+ rDesl+HSlrXEF9DnJqzHPG6GJdy1adcFNRFXl5OnOVn2Mv3/MtqSACTUar0xWSJZ5Y2O// o2uZaBBUGttWgeCClWPQSHxKSStp7PI= X-MC-Unique: sFddOjMoP-OQkDK--6QN_w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726666930; x=1727271730; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/hiqPq8RjsrMX+Agw8yMSR6RcXGHPvoGOxB2fMfGo9Q=; b=rrBItJDBoPRInYxBrM4ugXx8oLGZmlCeRBH15gIsuvOQQeMbE/jN2eyDlCRrosrxFu sqak1kilARs6FJocgV0KYDbwBRWXCHE7s/G3WOauU3saq1VyxZRD5qNKwaGixnaUp3lc y22cSveq1Hl45i3arIDXerPc+OU/B508QC34q0m+wK5NPe7pymkINNt8w84lGbRWQjZT HQb552FuxJRtPIv8osDce2Fvesy+grTv6VFgOgbjzFJ9fCbtQ8+hassbSNXQrz30o9Mz BwAq7ANMs19o4n/+qie6pQbyC0AERG5fDYpVF1jBfKet3fbmqg1wu0G2iy4g4GWY97GB RjOA== X-Gm-Message-State: AOJu0YyZ9v4tkag1zMlYmOV5D6OJILvCLCFiEtRk1TMv7qFYr6TA4dQK DacAO85vCJXb+Snn65J8McGijFtHZsyf9BjiAcLh1rn4MU9nUzXYtp6zSdHycyTNz47HFcEPhyq 6EN3PBqbWzeaWU8VnfpKOiKjAzGOxm0lxTpPeaJDfbFr7zp4c3VwizhI= X-Received: by 2002:a05:600c:46c3:b0:42c:b16e:7a0a with SMTP id 5b1f17b1804b1-42cdb5486c4mr140694045e9.20.1726666929907; Wed, 18 Sep 2024 06:42:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2bQXOgvEzekJry3tcpwJli/9rmAYsPVLvaqYCjSwj1FFBekbbj87eAnlwLaOgl7YMFDWDrg== X-Received: by 2002:a05:600c:46c3:b0:42c:b16e:7a0a with SMTP id 5b1f17b1804b1-42cdb5486c4mr140693925e9.20.1726666929437; Wed, 18 Sep 2024 06:42:09 -0700 (PDT) From: Martin Kletzander To: devel@lists.libvirt.org Subject: [PATCH 7/8] qemu: Use per-domain private memoryBackingDir for new memory backends Date: Wed, 18 Sep 2024 15:42:05 +0200 Message-ID: X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PQCQVNZUP3UYXG4JELARNN7OJ4MWQLXA X-Message-ID-Hash: PQCQVNZUP3UYXG4JELARNN7OJ4MWQLXA X-MailFrom: mkletzan@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Michael Galaxy X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1726667065680116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The function qemuGetMemoryBackingPath() does not need the @def any more and priv->memoryBackingDir can be used instead of constructing the path by calling qemuGetMemoryBackingDomainPath(). Signed-off-by: Martin Kletzander --- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_domain.c | 8 ++------ src/qemu/qemu_domain.h | 1 - src/qemu/qemu_process.c | 9 +++------ 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5d24439a6ff6..3e98d6707bc6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3421,7 +3421,7 @@ qemuBuildMemoryBackendProps(virJSONValue **backendPro= ps, } else { /* We can have both pagesize and mem source. If that's the cas= e, * prefer hugepages as those are more specific. */ - if (qemuGetMemoryBackingPath(priv, def, mem->info.alias, &memP= ath) < 0) + if (qemuGetMemoryBackingPath(priv, mem->info.alias, &memPath) = < 0) return -1; } =20 @@ -7315,7 +7315,7 @@ qemuBuildMemPathStr(const virDomainDef *def, return -1; prealloc =3D true; } else if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { - if (qemuGetMemoryBackingPath(priv, def, "ram", &mem_path) < 0) + if (qemuGetMemoryBackingPath(priv, "ram", &mem_path) < 0) return -1; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fd7c7fd56218..daec89fca1db 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -13210,8 +13210,7 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate= *priv, =20 /** * qemuGetMemoryBackingPath: - * @driver: the qemu driver - * @def: domain definition + * @priv: domain private data * @alias: memory object alias * @memPath: constructed path * @@ -13222,7 +13221,6 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate= *priv, */ int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, - const virDomainDef *def, const char *alias, char **memPath) { @@ -13235,9 +13233,7 @@ qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, return -1; } =20 - if (qemuGetMemoryBackingDomainPath(priv, def, &domainPath) < 0) - return -1; + *memPath =3D g_strdup_printf("%s/%s", priv->memoryBackingDir, alias); =20 - *memPath =3D g_strdup_printf("%s/%s", domainPath, alias); return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index b0fcbdd4673b..93d72c095160 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1177,6 +1177,5 @@ qemuGetMemoryBackingDomainPath(qemuDomainObjPrivate *= priv, char **path); int qemuGetMemoryBackingPath(qemuDomainObjPrivate *priv, - const virDomainDef *def, const char *alias, char **memPath); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1d3a905dd854..dd3afbeb39ac 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4094,12 +4094,9 @@ qemuProcessBuildDestroyMemoryPaths(virQEMUDriver *dr= iver, } =20 if (!build || shouldBuildMB) { - g_autofree char *path =3D NULL; - if (qemuGetMemoryBackingDomainPath(QEMU_DOMAIN_PRIVATE(vm), vm->de= f, &path) < 0) - return -1; - if (qemuProcessBuildDestroyMemoryPathsImpl(driver, vm, - path, build) < 0) + QEMU_DOMAIN_PRIVATE(vm)= ->memoryBackingDir, + build) < 0) return -1; } =20 @@ -4113,7 +4110,7 @@ qemuProcessDestroyMemoryBackingPath(virDomainObj *vm, { g_autofree char *path =3D NULL; =20 - if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), vm->def, mem->in= fo.alias, &path) < 0) + if (qemuGetMemoryBackingPath(QEMU_DOMAIN_PRIVATE(vm), mem->info.alias,= &path) < 0) return -1; =20 if (unlink(path) < 0 && --=20 2.46.0