mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-01 04:17:02 -05:00
Relax the check about small parity files, to allow to recover
after a failed sync before resizing the parity files.
This commit is contained in:
parent
9f72b5244b
commit
cef30125a2
4 changed files with 36 additions and 5 deletions
22
state.c
22
state.c
|
|
@ -38,7 +38,7 @@ void state_init(struct snapraid_state* state)
|
|||
state->pool_device = 0;
|
||||
state->lockfile[0] = 0;
|
||||
state->level = 1; /* default is the lowest protection */
|
||||
state->loaded_blockmax = 0;
|
||||
state->loaded_paritymax = 0;
|
||||
state->no_conf = 0;
|
||||
|
||||
tommy_list_init(&state->disklist);
|
||||
|
|
@ -894,6 +894,7 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE
|
|||
struct snapraid_file* file;
|
||||
block_off_t blockidx;
|
||||
block_off_t blockmax;
|
||||
block_off_t paritymax;
|
||||
unsigned line;
|
||||
unsigned count_file;
|
||||
unsigned count_block;
|
||||
|
|
@ -906,6 +907,7 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE
|
|||
line = 1;
|
||||
blockidx = 0;
|
||||
blockmax = 0;
|
||||
paritymax = 0;
|
||||
count_file = 0;
|
||||
count_block = 0;
|
||||
count_hardlink = 0;
|
||||
|
|
@ -963,6 +965,10 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE
|
|||
switch (tag[0]) {
|
||||
case 'b' :
|
||||
block_state_set(block, BLOCK_STATE_BLK);
|
||||
|
||||
/* keep track of the required parity size */
|
||||
if (v_pos + 1 > paritymax)
|
||||
paritymax = v_pos + 1;
|
||||
break;
|
||||
case 'n' :
|
||||
block_state_set(block, BLOCK_STATE_NEW);
|
||||
|
|
@ -1635,7 +1641,9 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE
|
|||
fprintf(stderr, "Internal inconsistency in parity size in '%s' at line %u\n", path, line);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
state->loaded_blockmax = blockmax;
|
||||
|
||||
/* set the required parity size */
|
||||
state->loaded_paritymax = paritymax;
|
||||
|
||||
if (state->opt.verbose) {
|
||||
printf("\tfile %u\n", count_file);
|
||||
|
|
@ -2029,6 +2037,7 @@ static void decoding_error(const char* path, STREAM* f)
|
|||
static void state_read_binary(struct snapraid_state* state, const char* path, STREAM* f)
|
||||
{
|
||||
block_off_t blockmax;
|
||||
block_off_t paritymax;
|
||||
unsigned count_file;
|
||||
unsigned count_block;
|
||||
unsigned count_hardlink;
|
||||
|
|
@ -2041,6 +2050,7 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
|||
uint32_t mapping_max;
|
||||
|
||||
blockmax = 0;
|
||||
paritymax = 0;
|
||||
count_file = 0;
|
||||
count_block = 0;
|
||||
count_hardlink = 0;
|
||||
|
|
@ -2199,6 +2209,10 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
|||
switch (c) {
|
||||
case 'b' :
|
||||
block_state_set(block, BLOCK_STATE_BLK);
|
||||
|
||||
/* keep track of the required parity size */
|
||||
if (v_pos + 1 > paritymax)
|
||||
paritymax = v_pos + 1;
|
||||
break;
|
||||
case 'n' :
|
||||
block_state_set(block, BLOCK_STATE_NEW);
|
||||
|
|
@ -2686,7 +2700,9 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST
|
|||
fprintf(stderr, "Internal inconsistency in parity size in '%s' at offset %"PRIi64"\n", path, stell(f));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
state->loaded_blockmax = blockmax;
|
||||
|
||||
/* set the required parity size */
|
||||
state->loaded_paritymax = paritymax;
|
||||
|
||||
if (state->opt.verbose) {
|
||||
printf("\tfile %u\n", count_file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue