mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-30 20:06:56 -05:00
Manages the degenerated cases of empty or skipping all.
Some change in the check screen output.
This commit is contained in:
parent
543658640a
commit
a30c93024a
7 changed files with 34 additions and 18 deletions
12
sync.c
12
sync.c
|
|
@ -127,8 +127,6 @@ static void state_sync_process(struct snapraid_state* state, int parity_f, block
|
|||
|
||||
printf("%u%% completed, %u MB processed\n", i * 100 / blockmax, (unsigned)(count_size / (1024*1024)));
|
||||
|
||||
printf("Done\n");
|
||||
|
||||
for(j=0;j<diskmax;++j) {
|
||||
handle_close(&handle[j]);
|
||||
}
|
||||
|
|
@ -148,9 +146,10 @@ void state_sync(struct snapraid_state* state, block_off_t blockstart)
|
|||
printf("Syncing...\n");
|
||||
|
||||
blockmax = parity_resize(state);
|
||||
|
||||
size = blockmax * (data_off_t)state->block_size;
|
||||
|
||||
if (blockstart >= blockmax) {
|
||||
if (blockstart > blockmax) {
|
||||
fprintf(stderr, "The specified starting block %u is bigger than the parity size %u.\n", blockstart, blockmax);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
@ -158,7 +157,12 @@ void state_sync(struct snapraid_state* state, block_off_t blockstart)
|
|||
pathcpy(path, sizeof(path), state->parity);
|
||||
f = parity_create(path, size);
|
||||
|
||||
state_sync_process(state, f, blockstart, blockmax);
|
||||
/* skip degenerated cases of empty parity, or skipping all */
|
||||
if (blockstart < blockmax) {
|
||||
state_sync_process(state, f, blockstart, blockmax);
|
||||
} else {
|
||||
printf("Nothing to do\n");
|
||||
}
|
||||
|
||||
parity_sync(path, f);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue