From 97c7daedee1fe903ea49a2321d615b101551c889 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 2 Mar 2014 17:05:21 +0100 Subject: [PATCH] Adds more logging info to diagnose the fix failures. --- check.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/check.c b/check.c index 38c96173..3b8e3352 100644 --- a/check.c +++ b/check.c @@ -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;jdisk->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;jdisk->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) {