public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Nicolas Frey <n.frey@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v4 2/9] verify: introduce new state struct
Date: Thu, 13 Nov 2025 10:31:11 +0100	[thread overview]
Message-ID: <20251113093118.195229-6-n.frey@proxmox.com> (raw)
In-Reply-To: <20251113093118.195229-1-n.frey@proxmox.com>

to prepare for better bundling when introducing parallel chunk loading

Suggested-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Nicolas Frey <n.frey@proxmox.com>
---
 src/backup/verify.rs | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/backup/verify.rs b/src/backup/verify.rs
index 2871f1a6..e8ea49b2 100644
--- a/src/backup/verify.rs
+++ b/src/backup/verify.rs
@@ -1,6 +1,6 @@
 use pbs_config::BackupLockGuard;
 use std::collections::HashSet;
-use std::sync::atomic::{AtomicUsize, Ordering};
+use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering};
 use std::sync::{Arc, Mutex};
 use std::time::Instant;
 
@@ -34,6 +34,34 @@ pub struct VerifyWorker {
     backend: DatastoreBackend,
 }
 
+struct IndexVerifyState {
+    read_bytes: AtomicU64,
+    decoded_bytes: AtomicU64,
+    errors: AtomicUsize,
+    datastore: Arc<DataStore>,
+    corrupt_chunks: Arc<Mutex<HashSet<[u8; 32]>>>,
+    verified_chunks: Arc<Mutex<HashSet<[u8; 32]>>>,
+    start_time: Instant,
+}
+
+impl IndexVerifyState {
+    fn new(
+        datastore: &Arc<DataStore>,
+        corrupt_chunks: &Arc<Mutex<HashSet<[u8; 32]>>>,
+        verified_chunks: &Arc<Mutex<HashSet<[u8; 32]>>>,
+    ) -> Self {
+        Self {
+            read_bytes: AtomicU64::new(0),
+            decoded_bytes: AtomicU64::new(0),
+            errors: AtomicUsize::new(0),
+            datastore: Arc::clone(datastore),
+            corrupt_chunks: Arc::clone(corrupt_chunks),
+            verified_chunks: Arc::clone(verified_chunks),
+            start_time: Instant::now(),
+        }
+    }
+}
+
 impl VerifyWorker {
     /// Creates a new VerifyWorker for a given task worker and datastore.
     pub fn new(
-- 
2.47.3


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


  parent reply	other threads:[~2025-11-13  9:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-13  9:31 [pbs-devel] [PATCH proxmox{, -backup} v4 00/12] parallelize chunk reads in verification Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox v4 1/3] pbs-api-types: add schema for {worker, read, verify}-threads Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox v4 2/3] pbs-api-types: jobs: add {read, verify}-threads to VerificationJobConfig Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox v4 3/3] pbs-api-types: use worker-threads schema for TapeBackupJobSetup Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 1/9] verify: correct typo in comment Nicolas Frey
2025-11-13  9:31 ` Nicolas Frey [this message]
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 3/9] verify: refactor into associated functions to use new state struct Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 4/9] verify: move chunk loading into parallel handler Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 5/9] verify: determine the number of threads to use with {read, verify}-threads Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 6/9] verify: add {read, verify}-threads to update endpoint Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 7/9] verify: add {read, verify}-threads to api schema in backup manager Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 8/9] ui: verify: add option to set number of threads for job Nicolas Frey
2025-11-13  9:31 ` [pbs-devel] [PATCH proxmox-backup v4 9/9] docs: verify: document {read, verify}-threads and update screenshot Nicolas Frey
2025-11-14 10:41   ` Christian Ebner
2025-11-13 12:53 ` [pbs-devel] [PATCH proxmox{, -backup} v4 00/12] parallelize chunk reads in verification Fabian Grünbichler
2025-11-14 10:46 ` Christian Ebner
2025-11-14 21:36 ` [pbs-devel] applied: " Thomas Lamprecht
2025-11-14 22:17 ` Thomas Lamprecht

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=20251113093118.195229-6-n.frey@proxmox.com \
    --to=n.frey@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