[pbs-devel] [PATCH proxmox-backup v4 2/9] verify: introduce new state struct
Nicolas Frey
n.frey at proxmox.com
Thu Nov 13 10:31:11 CET 2025
to prepare for better bundling when introducing parallel chunk loading
Suggested-by: Christian Ebner <c.ebner at proxmox.com>
Signed-off-by: Nicolas Frey <n.frey at 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
More information about the pbs-devel
mailing list