[pbs-devel] [PATCH proxmox-backup 1/4] datastore: fix clippy too many arguments warning

Christian Ebner c.ebner at proxmox.com
Thu Jan 8 16:25:17 CET 2026


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 <c.ebner at proxmox.com>
---
 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<T: FnOnce() -> 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





More information about the pbs-devel mailing list