Adds more logging info to diagnose the fix failures.

This commit is contained in:
Andrea Mazzoleni 2014-03-02 17:05:21 +01:00
parent b3fa576929
commit 97c7daedee

17
check.c
View file

@ -165,6 +165,7 @@ static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, u
/* if too many error, we don't have any strategy */
n = state->level;
if (failed_count > n) {
fprintf(stdlog, "strategy_error:%u: No strategy to recover from %u failures with %u parity\n", pos, failed_count, n);
return -1;
}
@ -269,8 +270,10 @@ static int repair_step(struct snapraid_state* state, int rehash, unsigned pos, u
/* return the number of failed attempts, or -1 if no strategy */
if (error)
return error;
else
return -1;
fprintf(stdlog, "strategy_error:%u: No strategy to recover from %u failures with %u parity %s hash\n",
pos, failed_count, n, has_hash ? "with" : "without");
return -1;
}
static int repair(struct snapraid_state* state, int rehash, unsigned pos, unsigned diskmax, struct failed_struct* failed, unsigned* failed_map, unsigned failed_count, void** buffer, void** buffer_recov, void* buffer_zero)
@ -643,6 +646,8 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].block = block;
failed[failed_count].handle = 0;
++failed_count;
fprintf(stdlog, "block_delete:%u:%s: Delete block\n", i, handle[j].disk->name);
continue;
}
@ -764,6 +769,8 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].block = block;
failed[failed_count].handle = &handle[j];
++failed_count;
fprintf(stdlog, "block_change:%u:%s:%s: Change block at position %u\n", i, handle[j].disk->name, block_file_get(block)->sub, block_file_pos(block));
continue;
}
@ -801,6 +808,8 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
failed[failed_count].block = block;
failed[failed_count].handle = &handle[j];
++failed_count;
fprintf(stdlog, "block_replace:%u:%s:%s: Replace block at position %u\n", i, handle[j].disk->name, block_file_get(block)->sub, block_file_pos(block));
continue;
}
}
@ -845,7 +854,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
/* print a list of all the errors in files */
for(j=0;j<failed_count;++j) {
if (failed[j].is_bad)
fprintf(stdlog, "unrecoverable:%u:%s:%s: Unrecoverable error at position %u\n", i, failed[j].handle->disk->name, block_file_get(failed[j].block)->sub, block_file_pos(failed[j].block));
fprintf(stdlog, "unrecoverable:%u:%s:%s: Unrecoverable synched error at position %u\n", i, failed[j].handle->disk->name, block_file_get(failed[j].block)->sub, block_file_pos(failed[j].block));
}
/* keep track of damaged files */
@ -863,7 +872,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna
for(j=0;j<failed_count;++j) {
if (failed[j].is_bad && failed[j].is_outofdate) {
++partial_recover_error;
fprintf(stdlog, "unrecoverable:%u:%s:%s: Unrecoverable error at position %u\n", i, failed[j].handle->disk->name, block_file_get(failed[j].block)->sub, block_file_pos(failed[j].block));
fprintf(stdlog, "unrecoverable:%u:%s:%s: Unrecoverable unsynched error at position %u\n", i, failed[j].handle->disk->name, block_file_get(failed[j].block)->sub, block_file_pos(failed[j].block));
}
}
if (partial_recover_error != 0) {