From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id A8E8B1FF15C for ; Fri, 14 Nov 2025 16:05:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id CB3BE169E4; Fri, 14 Nov 2025 16:06:36 +0100 (CET) From: Samuel Rufinatscha To: pbs-devel@lists.proxmox.com Date: Fri, 14 Nov 2025 16:05:41 +0100 Message-ID: <20251114150544.224839-2-s.rufinatscha@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251114150544.224839-1-s.rufinatscha@proxmox.com> References: <20251114150544.224839-1-s.rufinatscha@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1763132735162 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.039 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: [pbs-devel] [PATCH proxmox-backup v2 1/4] partial fix #6049: config: enable config version cache for datastore X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Repeated /status requests caused lookup_datastore() to re-read and parse datastore.cfg on every call. The issue was mentioned in report #6049 [1]. cargo-flamegraph [2] confirmed that the hot path is dominated by pbs_config::datastore::config() (config parsing). To solve the issue, this patch prepares the config version cache, so that datastore config caching can be built on top of it. This patch specifically: (1) implements increment function in order to invalidate generations (2) removes obsolete comments Links [1] Bugzilla: https://bugzilla.proxmox.com/show_bug.cgi?id=6049 [2] cargo-flamegraph: https://github.com/flamegraph-rs/flamegraph Signed-off-by: Samuel Rufinatscha --- pbs-config/src/config_version_cache.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pbs-config/src/config_version_cache.rs b/pbs-config/src/config_version_cache.rs index e8fb994f..b875f7e0 100644 --- a/pbs-config/src/config_version_cache.rs +++ b/pbs-config/src/config_version_cache.rs @@ -26,7 +26,6 @@ struct ConfigVersionCacheDataInner { // Traffic control (traffic-control.cfg) generation/version. traffic_control_generation: AtomicUsize, // datastore (datastore.cfg) generation/version - // FIXME: remove with PBS 3.0 datastore_generation: AtomicUsize, // Add further atomics here } @@ -145,8 +144,15 @@ impl ConfigVersionCache { .fetch_add(1, Ordering::AcqRel); } + /// Returns the datastore generation number. + pub fn datastore_generation(&self) -> usize { + self.shmem + .data() + .datastore_generation + .load(Ordering::Acquire) + } + /// Increase the datastore generation number. - // FIXME: remove with PBS 3.0 or make actually useful again in datastore lookup pub fn increase_datastore_generation(&self) -> usize { self.shmem .data() -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel