From bb3a4a54a1e0ecd82bad7e5a6e79aa174f98ad84 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 27 Nov 2016 20:57:22 +0100 Subject: [PATCH] When printing the diff bits, also tell how many in total --- cmdline/check.c | 4 ++-- cmdline/scrub.c | 8 ++++---- cmdline/sync.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmdline/check.c b/cmdline/check.c index 835f94fc..63aae376 100644 --- a/cmdline/check.c +++ b/cmdline/check.c @@ -1182,7 +1182,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna failed[failed_count].handle = &handle[j]; ++failed_count; - log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff); + log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u/%u\n", i, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff, BLOCK_HASH_SIZE*8); ++error; continue; } @@ -1282,7 +1282,7 @@ static int state_check_process(struct snapraid_state* state, int fix, struct sna /* mark that the read parity is wrong, setting ptr to 0 */ buffer_recov[l] = 0; - log_tag("parity_error:%u:%s: Data error, diff bits %u\n", i, lev_config_name(l), diff); + log_tag("parity_error:%u:%s: Data error, diff bits %u/%u\n", i, lev_config_name(l), diff, state->block_size*8); ++error; } } diff --git a/cmdline/scrub.c b/cmdline/scrub.c index 742c6dad..f4499887 100644 --- a/cmdline/scrub.c +++ b/cmdline/scrub.c @@ -473,14 +473,14 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par if (memcmp(hash, block->hash, BLOCK_HASH_SIZE) != 0) { unsigned diff = memdiff(hash, block->hash, BLOCK_HASH_SIZE); - log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff); + log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u/%u\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff, BLOCK_HASH_SIZE*8); /* it's a silent error only if we are dealing with synced files */ if (file_is_unsynced) { ++error; error_on_this_block = 1; } else { - log_error("Data error in file '%s' at position '%u', diff bits %u\n", task->path, file_pos, diff); + log_error("Data error in file '%s' at position '%u', diff bits %u/%u\n", task->path, file_pos, diff, BLOCK_HASH_SIZE*8); ++silent_error; silent_error_on_this_block = 1; } @@ -566,14 +566,14 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par if (buffer_recov[l] && memcmp(buffer[diskmax + l], buffer_recov[l], state->block_size) != 0) { unsigned diff = memdiff(buffer[diskmax + l], buffer_recov[l], state->block_size); - log_tag("parity_error:%u:%s: Data error, diff bits %u\n", blockcur, lev_config_name(l), diff); + log_tag("parity_error:%u:%s: Data error, diff bits %u/%u\n", blockcur, lev_config_name(l), diff, state->block_size*8); /* it's a silent error only if we are dealing with synced blocks */ if (block_is_unsynced) { ++error; error_on_this_block = 1; } else { - log_fatal("Data error in parity '%s' at position '%u', diff bits %u\n", lev_config_name(l), blockcur, diff); + log_fatal("Data error in parity '%s' at position '%u', diff bits %u/%u\n", lev_config_name(l), blockcur, diff, state->block_size*8); ++silent_error; silent_error_on_this_block = 1; } diff --git a/cmdline/sync.c b/cmdline/sync.c index 1d59c10a..1fb1ad1d 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -964,8 +964,8 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari continue; } else { /* otherwise it's a BLK with silent error */ unsigned diff = memdiff(hash, block->hash, BLOCK_HASH_SIZE); - log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff); - log_error("Data error in file '%s' at position '%u', diff bits %u\n", task->path, file_pos, diff); + log_tag("error:%u:%s:%s: Data error at position %u, diff bits %u/%u\n", blockcur, disk->name, esc_tag(file->sub, esc_buffer), file_pos, diff, BLOCK_HASH_SIZE*8); + log_error("Data error in file '%s' at position '%u', diff bits %u/%u\n", task->path, file_pos, diff, BLOCK_HASH_SIZE*8); /* save the failed block for the fix */ failed[failed_count].index = diskcur;