From aa9133e1c67e232a24eb6a0b724d2df7a4852761 Mon Sep 17 00:00:00 2001 From: wang384670111 <384670111@qq.com> Date: Mon, 8 Jan 2024 21:35:41 +0800 Subject: [PATCH] Use relaxed ordering for atomic block change counter --- src/upload.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/upload.rs b/src/upload.rs index 6faabc2..564eddd 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -218,7 +218,7 @@ impl SnapshotUploader { .fail()?; } - let changed_blocks_count = changed_blocks_count.load(AtomicOrdering::SeqCst); + let changed_blocks_count = changed_blocks_count.load(AtomicOrdering::Relaxed); // Compute the "linear" hash - the hash of all hashes in block index order. let block_digests = Arc::try_unwrap(block_digests) @@ -397,7 +397,7 @@ impl SnapshotUploader { block_digests.insert(block_index, hash_bytes.to_vec()); let changed_blocks_count = &context.changed_blocks_count; - changed_blocks_count.fetch_add(1, AtomicOrdering::SeqCst); + changed_blocks_count.fetch_add(1, AtomicOrdering::Relaxed); if let Some(ref progress_bar) = *context.progress_bar { progress_bar.inc(1);