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 80CAC1FF13D for ; Thu, 08 Jan 2026 16:25:40 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1B52927CDB; Thu, 8 Jan 2026 16:25:41 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 8 Jan 2026 16:25:17 +0100 Message-ID: <20260108152520.783200-2-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260108152520.783200-1-c.ebner@proxmox.com> References: <20260108152520.783200-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1767885899832 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 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 Subject: [pbs-devel] [PATCH proxmox-backup 1/4] datastore: fix clippy too many arguments warning 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" Introduce a transient CondSweepChunkParams type to limit the function call arguments for the ChunkStore::cond_sweep_chunk() method. No functional changes. Signed-off-by: Christian Ebner --- pbs-datastore/src/chunk_store.rs | 46 +++++++++++++++++++------------- pbs-datastore/src/datastore.rs | 14 +++++----- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/pbs-datastore/src/chunk_store.rs b/pbs-datastore/src/chunk_store.rs index 7fe09b914..cccfcfcdf 100644 --- a/pbs-datastore/src/chunk_store.rs +++ b/pbs-datastore/src/chunk_store.rs @@ -39,6 +39,16 @@ pub struct ChunkStore { // TODO: what about sysctl setting vm.vfs_cache_pressure (0 - 100) ? +/// Transient type used to limit the number of function call parameters +/// for ChunkStore::cond_sweep_chunk() +pub(super) struct CondSweepChunkParams { + pub(super) atime: i64, + pub(super) min_atime: i64, + pub(super) oldest_writer: i64, + pub(super) size: u64, + pub(super) bad: bool, +} + pub fn verify_chunk_size(size: usize) -> Result<(), Error> { static SIZES: [usize; 7] = [ 64 * 1024, @@ -443,11 +453,13 @@ impl ChunkStore { unsafe { self.cond_sweep_chunk( - stat.st_atime, - min_atime, - oldest_writer, - stat.st_size as u64, - bad, + CondSweepChunkParams { + atime: stat.st_atime, + min_atime, + oldest_writer, + size: stat.st_size as u64, + bad, + }, status, || { // non-bad S3 chunks need to be removed via cache @@ -495,39 +507,35 @@ impl ChunkStore { /// FIXME: make this internal with further refactoring pub(super) unsafe fn cond_sweep_chunk Result<(), Error>>( &self, - atime: i64, - min_atime: i64, - oldest_writer: i64, - size: u64, - bad: bool, + params: CondSweepChunkParams, gc_status: &mut GarbageCollectionStatus, remove_callback: T, ) -> Result<(), Error> { - if atime < min_atime { + if params.atime < params.min_atime { if let Err(err) = remove_callback() { - if bad { + if params.bad { gc_status.still_bad += 1; } return Err(err); } - if bad { + if params.bad { gc_status.removed_bad += 1; } else { gc_status.removed_chunks += 1; } - gc_status.removed_bytes += size; - } else if atime < oldest_writer { - if bad { + gc_status.removed_bytes += params.size; + } else if params.atime < params.oldest_writer { + if params.bad { gc_status.still_bad += 1; } else { gc_status.pending_chunks += 1; } - gc_status.pending_bytes += size; + gc_status.pending_bytes += params.size; } else { - if !bad { + if !params.bad { gc_status.disk_chunks += 1; } - gc_status.disk_bytes += size; + gc_status.disk_bytes += params.size; } Ok(()) } diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 9c57aaac1..2f401f6fd 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -39,7 +39,7 @@ use pbs_config::BackupLockGuard; use crate::backup_info::{ BackupDir, BackupGroup, BackupInfo, OLD_LOCKING, PROTECTED_MARKER_FILENAME, }; -use crate::chunk_store::ChunkStore; +use crate::chunk_store::{ChunkStore, CondSweepChunkParams}; use crate::dynamic_index::{DynamicIndexReader, DynamicIndexWriter}; use crate::fixed_index::{FixedIndexReader, FixedIndexWriter}; use crate::hierarchy::{ListGroups, ListGroupsType, ListNamespaces, ListNamespacesRecursive}; @@ -1765,11 +1765,13 @@ impl DataStore { unsafe { self.inner.chunk_store.cond_sweep_chunk( - atime, - min_atime, - oldest_writer, - content.size, - bad, + CondSweepChunkParams { + atime, + min_atime, + oldest_writer, + size: content.size, + bad, + }, &mut gc_status, || { if let Some(cache) = self.cache() { -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel