Merges NEW and CHG blocks and introduces REP blocks.

This is a preparation for using REP blocks for containing hashes
of new data.
This commit is contained in:
Andrea Mazzoleni 2014-02-01 17:57:26 +01:00
parent e14966eef1
commit ba1d6ed2b6
6 changed files with 376 additions and 235 deletions

11
scrub.c
View file

@ -182,6 +182,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
silent_error_on_this_block = 0;
/* if all the blocks at this address are synched */
/* if not, parity is not even checked */
block_is_unsynched = 0;
/* if we have to use the old hash */
@ -195,6 +196,7 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
int file_is_unsynched;
/* if the file on this disk is synched */
/* if not, silent errors are assumed as expected error */
file_is_unsynched = 0;
/* by default no rehash in case of "continue" */
@ -215,6 +217,15 @@ static int state_scrub_process(struct snapraid_state* state, struct snapraid_par
continue;
}
/* if the block is unsynched, errors are expected */
if (block_has_invalid_parity(block)) {
/* report that the block and the file are not synched */
block_is_unsynched = 1;
file_is_unsynched = 1;
/* follow */
}
/* if the file is different than the current one, close it */
if (handle[j].file != 0 && handle[j].file != block_file_get(block)) {
/* keep a pointer at the file we are going to close for error reporting */