]> git.proxmox.com Git - proxmox-backup.git/commit
gc: remove .bad files on garbage collect
authorStefan Reiter <s.reiter@proxmox.com>
Mon, 7 Sep 2020 15:30:34 +0000 (17:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 8 Sep 2020 10:43:13 +0000 (12:43 +0200)
commita9767cf7de6d050ab2f3d8baec382c7312c62bca
tree059f4acac721578a205b418d41745a982d5dbc6a
parentaadcc2815c0c19c2535c96df1d42918ac77f8e82
gc: remove .bad files on garbage collect

The iterator of get_chunk_iterator is extended with a third parameter
indicating whether the current file is a chunk (false) or a .bad file
(true).

Count their sizes to the total of removed bytes, since it also frees
disk space.

.bad files are only deleted if the corresponding chunk exists, i.e. has
been rewritten. Otherwise we might delete data only marked bad because
of transient errors.

While at it, also clean up and use nix::unistd::unlinkat instead of
unsafe libc calls.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
src/api2/types/mod.rs
src/backup/chunk_store.rs
src/backup/datastore.rs