From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B54721FF185 for ; Mon, 7 Jul 2025 15:26:28 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8F0BF33C16; Mon, 7 Jul 2025 15:27:10 +0200 (CEST) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Mon, 7 Jul 2025 15:27:04 +0200 Message-Id: <20250707132706.2854973-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250707132706.2854973-1-d.csapak@proxmox.com> References: <20250707132706.2854973-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.021 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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] [RFC PATCH proxmox-backup 1/3] verify: rename variables 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" 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 --- 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