From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E7AE41FF135 for ; Thu, 02 Jul 2026 17:01:05 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B3DE1214D8; Thu, 02 Jul 2026 17:01:05 +0200 (CEST) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v2 10/13] task tracking: count WriteNonExpanding datastore operations Date: Thu, 2 Jul 2026 16:59:07 +0200 Message-ID: <20260702145916.360488-11-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260702145916.360488-1-r.obkircher@proxmox.com> References: <20260702145916.360488-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: 1783004426422 X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) 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: AV3Y5XXXPSQUZKIEEL5SRUFT6TY6UK3A X-Message-ID-Hash: AV3Y5XXXPSQUZKIEEL5SRUFT6TY6UK3A 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 Reviewed-by: Christian Ebner Tested-by: Christian Ebner --- 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 2f8b93f7f..39e5929c9 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -2032,6 +2032,7 @@ pub fn get_active_operations(store: String, _param: Value) -> Result