backup/datastore: count still bad chunks for the status

we want to show the user that there are still bad chunks after a garbage
collection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-10-23 16:32:31 +02:00 committed by Thomas Lamprecht
parent f23497b088
commit a2285525be
2 changed files with 5 additions and 0 deletions

View File

@ -587,6 +587,8 @@ pub struct GarbageCollectionStatus {
pub pending_chunks: usize, pub pending_chunks: usize,
/// Number of chunks marked as .bad by verify that have been removed by GC. /// Number of chunks marked as .bad by verify that have been removed by GC.
pub removed_bad: usize, pub removed_bad: usize,
/// Number of chunks still marked as .bad after garbage collection.
pub still_bad: usize,
} }
impl Default for GarbageCollectionStatus { impl Default for GarbageCollectionStatus {
@ -602,6 +604,7 @@ impl Default for GarbageCollectionStatus {
pending_bytes: 0, pending_bytes: 0,
pending_chunks: 0, pending_chunks: 0,
removed_bad: 0, removed_bad: 0,
still_bad: 0,
} }
} }
} }

View File

@ -354,9 +354,11 @@ impl ChunkStore {
}, },
Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => { Err(nix::Error::Sys(nix::errno::Errno::ENOENT)) => {
// chunk hasn't been rewritten yet, keep .bad file // chunk hasn't been rewritten yet, keep .bad file
status.still_bad += 1;
}, },
Err(err) => { Err(err) => {
// some other error, warn user and keep .bad file around too // some other error, warn user and keep .bad file around too
status.still_bad += 1;
crate::task_warn!( crate::task_warn!(
worker, worker,
"error during stat on '{:?}' - {}", "error during stat on '{:?}' - {}",