diff --git a/TODO b/TODO index afafea4a..7e8c72e2 100644 --- a/TODO +++ b/TODO @@ -5,6 +5,10 @@ This is the list of TODO items for SnapRAID. - Next +* Recognize if the content file is older than parity, +and in case make a full sync after asking for configuration +with a --force option. + * Measures the time waited in blocking syscall for each disk, and prints stats of the disk speeds when the command finish, or when it's running. diff --git a/cmdline/scan.c b/cmdline/scan.c index b0c7014d..875842cc 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -191,8 +191,8 @@ static void scan_file_deallocate(struct snapraid_scan* scan, struct snapraid_fil /* we keep the hash making it an "old" hash, because the parity is still containing data for it */ break; case BLOCK_STATE_CHG : - /* if we have not already cleared the undeterminated hash */ - if (!state->clear_undeterminate_hash) { + /* if we have not already cleared the past hash */ + if (!state->clear_past_hash) { /* in these cases we don't know if the old state is still the one */ /* stored inside the parity, because after an aborted sync, the parity */ /* may be or may be not have been updated with the data that it's now */ @@ -417,8 +417,8 @@ static void scan_file_insert(struct snapraid_scan* scan, struct snapraid_file* f /* copy the past hash of the block */ memcpy(block->hash, over_block->hash, HASH_SIZE); - /* if we have not already cleared the undeterminated hash */ - if (!state->clear_undeterminate_hash) { + /* if we have not already cleared the past hash */ + if (!state->clear_past_hash) { /* in this case we don't know if the old state is still the one */ /* stored inside the parity, because after an aborted sync, the parity */ /* may be or may be not have been updated with the new data */ diff --git a/cmdline/snapraid.c b/cmdline/snapraid.c index 1496e94c..b5273a81 100644 --- a/cmdline/snapraid.c +++ b/cmdline/snapraid.c @@ -800,13 +800,13 @@ int main(int argc, char* argv[]) state_scan(&state, 1); } else if (operation == OPERATION_SYNC) { - /* in the next state read ensures to clear all the undeterminated hashes in case */ + /* in the next state read ensures to clear all the past hashes in case */ /* we are reading from an incomplete sync */ /* The undeterminated hash are only for CHG/DELETED blocks for which we don't */ /* know if the previous interrupted sync was able to update or not the parity */ /* The sync process instead needs to trust this information because it's used */ /* to avoid to recompute the parity if all the input are equals as before. */ - state.clear_undeterminate_hash = 1; + state.clear_past_hash = 1; state_read(&state); diff --git a/cmdline/state.c b/cmdline/state.c index f1ff89c6..806278f3 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -90,7 +90,7 @@ void state_init(struct snapraid_state* state) state->lockfile[0] = 0; state->level = 1; /* default is the lowest protection */ state->loaded_paritymax = 0; - state->clear_undeterminate_hash = 0; + state->clear_past_hash = 0; state->no_conf = 0; tommy_list_init(&state->disklist); @@ -1343,7 +1343,7 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE /* if the block contains a hash of past data */ /* and we are clearing such undeterminated hashes */ - if (state->clear_undeterminate_hash + if (state->clear_past_hash && block_has_past_hash(block) ) { /* set the hash value to INVALID */ @@ -1508,7 +1508,7 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE } /* if we are clearing undeterminated hashes */ - if (state->clear_undeterminate_hash) { + if (state->clear_past_hash) { /* set the hash value to INVALID */ hash_invalid_set(deleted->block.hash); } @@ -2842,7 +2842,7 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST /* if the block contains a hash of past data */ /* and we are clearing such undeterminated hashes */ - if (state->clear_undeterminate_hash + if (state->clear_past_hash && block_has_past_hash(block) ) { /* set the hash value to INVALID */ @@ -3061,7 +3061,7 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST } /* if we are clearing undeterminated hashes */ - if (state->clear_undeterminate_hash) { + if (state->clear_past_hash) { /* set the hash value to INVALID */ hash_invalid_set(deleted->block.hash); } diff --git a/cmdline/state.h b/cmdline/state.h index 8de6f8a0..2ad6bb91 100644 --- a/cmdline/state.h +++ b/cmdline/state.h @@ -130,7 +130,7 @@ struct snapraid_state { */ block_off_t loaded_paritymax; - int clear_undeterminate_hash; /**< Clear all the hash from CHG and DELETED blocks when reading the state from an incomplete sync. */ + int clear_past_hash; /**< Clear all the hash from CHG and DELETED blocks when reading the state from an incomplete sync. */ time_t progress_start; /**< Start of processing for progress visualization. */ time_t progress_last; /**< Last update of progress visualization. */ time_t progress_interruption; /**< Start of the measure interruption. */ diff --git a/cmdline/sync.c b/cmdline/sync.c index ef2748a0..bfea61b0 100644 --- a/cmdline/sync.c +++ b/cmdline/sync.c @@ -341,7 +341,7 @@ static int state_sync_process(struct snapraid_state* state, struct snapraid_pari /* the sync process assumes that all the hashes are correct */ /* including the ones from CHG and DELETED blocks */ - assert(state->clear_undeterminate_hash != 0); + assert(state->clear_past_hash != 0); /* get the present time */ now = time(0);