From 69acc1e251f59922f0c44a3e7b2ff2a8ab741a52 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 15 Jun 2014 17:56:43 +0200 Subject: [PATCH] Disables reallocation if a rehash is in progress. Be more conservative about rehash. No functional change is expected because we were already checking rehash for blocks with updated hash. But this way the code is simpler and easy to understand. --- cmdline/scan.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/cmdline/scan.c b/cmdline/scan.c index 875842cc..4438beea 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -239,27 +239,20 @@ static int file_is_full_invalid_parity_and_stable(struct snapraid_state* state, return 0; /* check all blocks */ - /* it should be enough to check only the first one */ - /* because updates are always in forward direction, */ - /* but we check all just to be sure */ for(i=0;iblockmax;++i) { struct snapraid_block* block = &file->blockvec[i]; + snapraid_info info; /* exclude blocks with parity */ if (!block_has_invalid_parity(block)) return 0; - /* exclude blocks with hash needing a rehash */ - if (block_has_updated_hash(block)) { - snapraid_info info; - - /* get block specific info */ - info = info_get(&state->infoarr, block->parity_pos); + /* get block specific info */ + info = info_get(&state->infoarr, block->parity_pos); - /* if rehash fails */ - if (info_get_rehash(info)) - return 0; - } + /* if rehash fails */ + if (info_get_rehash(info)) + return 0; } return 1;