From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id C495E1FF141 for ; Tue, 02 Jun 2026 15:01:08 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0B63B13804; Tue, 2 Jun 2026 15:01:07 +0200 (CEST) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup 4/6] task tracking: count WriteNonExpanding datastore operations Date: Tue, 2 Jun 2026 14:59:00 +0200 Message-ID: <20260602130001.217482-10-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260602130001.217482-1-r.obkircher@proxmox.com> References: <20260602130001.217482-1-r.obkircher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1780405213979 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.053 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: C2QBEAVBBYKFLIABYRFZQ7N7ZCKC72ZU X-Message-ID-Hash: C2QBEAVBBYKFLIABYRFZQ7N7ZCKC72ZU X-MailFrom: r.obkircher@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Count WriteNonExpanding as writes to ensure that switching over from Write does not break forward compatibility when older versions read the counters. Also add a new counter to display the GarbageCollection maintenance mode conflicts. It may not be accurate while older processes are running but it should be good enough for the UI. Signed-off-by: Robert Obkircher --- pbs-datastore/src/task_tracking.rs | 12 ++++++++++++ src/api2/admin/datastore.rs | 1 + 2 files changed, 13 insertions(+) diff --git a/pbs-datastore/src/task_tracking.rs b/pbs-datastore/src/task_tracking.rs index a67b77221..87ce4f5de 100644 --- a/pbs-datastore/src/task_tracking.rs +++ b/pbs-datastore/src/task_tracking.rs @@ -13,6 +13,12 @@ use serde::{Deserialize, Serialize}; pub struct ActiveOperationStats { pub read: i64, pub write: i64, + /// The number of writers that do not significantly increase disk usage. + /// + /// The count is unreliable because older processes without this field + /// will delete it on every update! + #[serde(default)] + pub write_non_expanding: i64, } impl ActiveOperationStats { @@ -20,6 +26,11 @@ impl ActiveOperationStats { match operation { Operation::Read => self.read += count, Operation::Write => self.write += count, + Operation::WriteNonExpanding => { + self.write += count; + // prevent underflow if an older process deleted the field + self.write_non_expanding = (self.write_non_expanding + count).max(0); + } Operation::Lookup => (), // no IO must happen there } } @@ -33,6 +44,7 @@ impl Sum for ActiveOperationStats { iter.fold(Self::default(), |a, b| Self { read: a.read + b.read, write: a.write + b.write, + write_non_expanding: a.write_non_expanding + b.write_non_expanding, }) } } diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 94272c32d..3cbdd8922 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -2024,6 +2024,7 @@ pub fn get_active_operations(store: String, _param: Value) -> Result