mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-30 20:06:56 -05:00
Track current and previous hash generations for deallocated blocks
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
This commit is contained in:
parent
0440d74fb5
commit
b023939c6b
6 changed files with 103 additions and 61 deletions
|
|
@ -18,6 +18,7 @@ void state_rehash(struct snapraid_state* state)
|
|||
{
|
||||
block_off_t blockmax;
|
||||
block_off_t i;
|
||||
int has_pending_dealloc = 0;
|
||||
|
||||
blockmax = parity_allocated_size(state);
|
||||
|
||||
|
|
@ -38,8 +39,17 @@ void state_rehash(struct snapraid_state* state)
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* deleted-only positions are not counted in unsynced_blocks, but their hashes still need the current generation */
|
||||
for (tommy_node* node = state->disklist; node != 0; node = node->next) {
|
||||
struct snapraid_disk* disk = node->data;
|
||||
if (!tommy_list_empty(&disk->dealloclist)) {
|
||||
has_pending_dealloc = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* a rehash can start only from a fully synchronized state */
|
||||
if (state->unsynced_blocks != 0) {
|
||||
if (state->unsynced_blocks != 0 || has_pending_dealloc) {
|
||||
/* LCOV_EXCL_START */
|
||||
log_tag("summary:exit:sync_required\n");
|
||||
log_fatal(EUSER, "You cannot start a rehash with an incomplete sync.\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue