backup verify: do not check every loop iteration for abort/shutdown

only check every 1024'th, which is cheaper to do than a modulo, as we
can just mask the 10 least-significant-bits and check if the result
is zero.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-04-15 12:56:30 +02:00
parent 7b2d3a5fe9
commit 2e1b63fb25
1 changed files with 4 additions and 2 deletions

View File

@ -185,8 +185,10 @@ fn verify_index_chunks(
use std::os::unix::fs::MetadataExt;
for pos in 0..index_count {
verify_worker.worker.check_abort()?;
crate::tools::fail_on_shutdown()?;
if pos & 1023 == 0 {
verify_worker.worker.check_abort()?;
crate::tools::fail_on_shutdown()?;
}
let info = index.chunk_info(pos).unwrap();