public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [RFC PATCH proxmox-backup 1/3] verify: rename variables
Date: Mon,  7 Jul 2025 15:27:04 +0200	[thread overview]
Message-ID: <20250707132706.2854973-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250707132706.2854973-1-d.csapak@proxmox.com>

give them a better name by moving the cloning into a block just before
the closure, since there is no naming conflict.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
this patch is just there so one can better see the changes in 2/3

 src/backup/verify.rs | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/backup/verify.rs b/src/backup/verify.rs
index 3d2cba8ac..ba4ca4d2f 100644
--- a/src/backup/verify.rs
+++ b/src/backup/verify.rs
@@ -109,20 +109,18 @@ fn verify_index_chunks(
     let mut read_bytes = 0;
     let mut decoded_bytes = 0;
 
-    let datastore2 = Arc::clone(&verify_worker.datastore);
-    let corrupt_chunks2 = Arc::clone(&verify_worker.corrupt_chunks);
-    let verified_chunks2 = Arc::clone(&verify_worker.verified_chunks);
-    let errors2 = Arc::clone(&errors);
-
-    let decoder_pool = ParallelHandler::new(
-        "verify chunk decoder",
-        4,
+    let decoder_pool = ParallelHandler::new("verify chunk decoder", 4, {
+        let datastore = Arc::clone(&verify_worker.datastore);
+        let corrupt_chunks = Arc::clone(&verify_worker.corrupt_chunks);
+        let verified_chunks = Arc::clone(&verify_worker.verified_chunks);
+        let errors = Arc::clone(&errors);
+
         move |(chunk, digest, size): (DataBlob, [u8; 32], u64)| {
             let chunk_crypt_mode = match chunk.crypt_mode() {
                 Err(err) => {
-                    corrupt_chunks2.lock().unwrap().insert(digest);
+                    corrupt_chunks.lock().unwrap().insert(digest);
                     info!("can't verify chunk, unknown CryptMode - {err}");
-                    errors2.fetch_add(1, Ordering::SeqCst);
+                    errors.fetch_add(1, Ordering::SeqCst);
                     return Ok(());
                 }
                 Ok(mode) => mode,
@@ -132,21 +130,21 @@ fn verify_index_chunks(
                 info!(
                     "chunk CryptMode {chunk_crypt_mode:?} does not match index CryptMode {crypt_mode:?}"
                 );
-                errors2.fetch_add(1, Ordering::SeqCst);
+                errors.fetch_add(1, Ordering::SeqCst);
             }
 
             if let Err(err) = chunk.verify_unencrypted(size as usize, &digest) {
-                corrupt_chunks2.lock().unwrap().insert(digest);
+                corrupt_chunks.lock().unwrap().insert(digest);
                 info!("{err}");
-                errors2.fetch_add(1, Ordering::SeqCst);
-                rename_corrupted_chunk(datastore2.clone(), &digest);
+                errors.fetch_add(1, Ordering::SeqCst);
+                rename_corrupted_chunk(datastore.clone(), &digest);
             } else {
-                verified_chunks2.lock().unwrap().insert(digest);
+                verified_chunks.lock().unwrap().insert(digest);
             }
 
             Ok(())
-        },
-    );
+        }
+    });
 
     let skip_chunk = |digest: &[u8; 32]| -> bool {
         if verify_worker
-- 
2.39.5



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


  reply	other threads:[~2025-07-07 13:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-07 13:27 [pbs-devel] [RFC PATCH proxmox-backup stable-3 0/3] improve verify speed under certain conditions Dominik Csapak
2025-07-07 13:27 ` Dominik Csapak [this message]
2025-07-07 13:27 ` [pbs-devel] [RFC PATCH proxmox-backup 2/3] verify: move chunk loading into parallel handler Dominik Csapak
2025-07-07 13:27 ` [pbs-devel] [RFC PATCH proxmox-backup 3/3] verify: use separate read pool for reading chunks Dominik Csapak

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=20250707132706.2854973-2-d.csapak@proxmox.com \
    --to=d.csapak@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