From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/4] datastore: fix clippy too many arguments warning
Date: Thu, 8 Jan 2026 16:25:17 +0100 [thread overview]
Message-ID: <20260108152520.783200-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260108152520.783200-1-c.ebner@proxmox.com>
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@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
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2026-01-08 15:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-08 15:25 [pbs-devel] [PATCH proxmox-backup 0/4] fix #7219: align encryption key loading behavior for mount Christian Ebner
2026-01-08 15:25 ` Christian Ebner [this message]
2026-01-08 15:25 ` [pbs-devel] [PATCH proxmox-backup 2/4] tree-wide: fix clippy warnings needless borrow Christian Ebner
2026-01-08 15:25 ` [pbs-devel] [PATCH proxmox-backup 3/4] api: access: silence too may arguments warning on api handler Christian Ebner
2026-01-08 15:25 ` [pbs-devel] [PATCH proxmox-backup 4/4] fix #7219: client: mount: align encryption key loading behavior Christian Ebner
2026-01-09 12:33 ` Daniel Herzig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260108152520.783200-2-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox