public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH backup 4/8] snapshot_reader: replace Arc with Rc
Date: Thu,  6 Mar 2025 14:12:31 +0100	[thread overview]
Message-ID: <20250306131235.452521-4-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20250306131235.452521-1-m.sandoval@proxmox.com>

The type `Box<dyn IndexFile + Send>>, usize, Vec<(usize, u64)>` is not
Sync so it makes more sense to use Rc. This is suggested by clippy.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pbs-datastore/src/snapshot_reader.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pbs-datastore/src/snapshot_reader.rs b/pbs-datastore/src/snapshot_reader.rs
index b9c3d931..36349888 100644
--- a/pbs-datastore/src/snapshot_reader.rs
+++ b/pbs-datastore/src/snapshot_reader.rs
@@ -2,6 +2,7 @@ use std::fs::File;
 use std::os::unix::io::{AsRawFd, FromRawFd};
 use std::path::Path;
 use std::sync::Arc;
+use std::rc::Rc;
 
 use anyhow::{bail, Error};
 use nix::dir::Dir;
@@ -128,7 +129,7 @@ pub struct SnapshotChunkIterator<'a, F: Fn(&[u8; 32]) -> bool> {
     todo_list: Vec<String>,
     skip_fn: F,
     #[allow(clippy::type_complexity)]
-    current_index: Option<(Arc<Box<dyn IndexFile + Send>>, usize, Vec<(usize, u64)>)>,
+    current_index: Option<(Rc<Box<dyn IndexFile + Send>>, usize, Vec<(usize, u64)>)>,
 }
 
 impl<F: Fn(&[u8; 32]) -> bool> Iterator for SnapshotChunkIterator<'_, F> {
@@ -158,7 +159,7 @@ impl<F: Fn(&[u8; 32]) -> bool> Iterator for SnapshotChunkIterator<'_, F> {
                         let order =
                             datastore.get_chunks_in_order(&*index, &self.skip_fn, |_| Ok(()))?;
 
-                        self.current_index = Some((Arc::new(index), 0, order));
+                        self.current_index = Some((Rc::new(index), 0, order));
                     } else {
                         return Ok(None);
                     }
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2025-03-06 13:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 13:12 [pbs-devel] [PATCH backup 1/8] server: remove needless clone Maximiliano Sandoval
2025-03-06 13:12 ` [pbs-devel] [PATCH backup 2/8] run cargo clippy --fix Maximiliano Sandoval
2025-03-06 13:12 ` [pbs-devel] [PATCH backup 3/8] api: remove redundant guard Maximiliano Sandoval
2025-03-06 13:12 ` Maximiliano Sandoval [this message]
2025-03-06 13:12 ` [pbs-devel] [PATCH backup 5/8] fix the type_complexity clippy lint Maximiliano Sandoval
2025-03-06 13:12 ` [pbs-devel] [PATCH backup 6/8] create a CachedSchema struct Maximiliano Sandoval
2025-03-06 13:12 ` [pbs-devel] [PATCH backup 7/8] zfs: remove unnecessary arc from dataset object map Maximiliano Sandoval
2025-03-06 13:12 ` [pbs-devel] [PATCH backup 8/8] add too_many_arguments clippy exception Maximiliano Sandoval
2025-03-06 14:00 ` [pbs-devel] applied-series: [PATCH backup 1/8] server: remove needless clone Wolfgang Bumiller

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=20250306131235.452521-4-m.sandoval@proxmox.com \
    --to=m.sandoval@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal