mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 06:56:28 -05:00
Track deallocated files in the content file for parity recovery
Add a new 'dealloc' list per disk to record files that were removed or modified during a scan. This list is saved in the content file (new format version SNAPCNT4) so that past parity contributions of those files can be imported from previous snapshots.
This commit is contained in:
parent
cebc9b62f2
commit
1aae44a2a3
9 changed files with 417 additions and 10 deletions
|
|
@ -51,6 +51,7 @@ int state_status(struct snapraid_state* state)
|
|||
uint64_t file_size;
|
||||
uint64_t file_block_count;
|
||||
uint64_t file_block_free;
|
||||
unsigned dealloc_count;
|
||||
block_off_t parity_block_free;
|
||||
uint64_t all_wasted;
|
||||
int free_not_zero;
|
||||
|
|
@ -84,6 +85,7 @@ int state_status(struct snapraid_state* state)
|
|||
printf(" Files Fragments GB GB GB\n");
|
||||
|
||||
/* count fragments */
|
||||
dealloc_count = 0;
|
||||
file_count = 0;
|
||||
file_size = 0;
|
||||
file_block_count = 0;
|
||||
|
|
@ -110,6 +112,8 @@ int state_status(struct snapraid_state* state)
|
|||
uint64_t disk_free_bytes;
|
||||
int64_t wasted;
|
||||
|
||||
dealloc_count += tommy_list_count(&disk->dealloclist);
|
||||
|
||||
/* for each file in the disk */
|
||||
node = disk->filelist;
|
||||
while (node) {
|
||||
|
|
@ -377,6 +381,16 @@ int state_status(struct snapraid_state* state)
|
|||
if (state->unsynced_blocks) {
|
||||
printf("WARNING! The array is NOT fully synced.\n");
|
||||
printf("You have a sync in progress at %u%%.\n", muldiv(blockmax - state->unsynced_blocks, 100, blockmax));
|
||||
if (dealloc_count) {
|
||||
printf("WARNING! There are %u files updated or deleted from the array that may reduce the recovery probability until the next sync.\n", dealloc_count);
|
||||
for (node_disk = state->disklist; node_disk != 0; node_disk = node_disk->next) {
|
||||
struct snapraid_disk* disk = node_disk->data;
|
||||
for (tommy_node* node = tommy_list_head(&disk->dealloclist); node != 0; node = node->next) {
|
||||
struct snapraid_dealloc* dealloc = node->data;
|
||||
msg_verbose("\t%s\n", fmt_term(disk, dealloc->sub));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("No sync is in progress.\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue