Renames "undetermined" to "past" as it represents better the meaning.

This commit is contained in:
Andrea Mazzoleni 2014-06-13 20:52:03 +02:00
parent da08ca4497
commit efd63bc032
6 changed files with 17 additions and 13 deletions

4
TODO
View file

@ -5,6 +5,10 @@ This is the list of TODO items for SnapRAID.
- Next - 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, * Measures the time waited in blocking syscall for each disk,
and prints stats of the disk speeds when the command finish, and prints stats of the disk speeds when the command finish,
or when it's running. or when it's running.

View file

@ -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 */ /* we keep the hash making it an "old" hash, because the parity is still containing data for it */
break; break;
case BLOCK_STATE_CHG : case BLOCK_STATE_CHG :
/* if we have not already cleared the undeterminated hash */ /* if we have not already cleared the past hash */
if (!state->clear_undeterminate_hash) { if (!state->clear_past_hash) {
/* in these cases we don't know if the old state is still the one */ /* 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 */ /* 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 */ /* 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 */ /* copy the past hash of the block */
memcpy(block->hash, over_block->hash, HASH_SIZE); memcpy(block->hash, over_block->hash, HASH_SIZE);
/* if we have not already cleared the undeterminated hash */ /* if we have not already cleared the past hash */
if (!state->clear_undeterminate_hash) { if (!state->clear_past_hash) {
/* in this case we don't know if the old state is still the one */ /* 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 */ /* stored inside the parity, because after an aborted sync, the parity */
/* may be or may be not have been updated with the new data */ /* may be or may be not have been updated with the new data */

View file

@ -800,13 +800,13 @@ int main(int argc, char* argv[])
state_scan(&state, 1); state_scan(&state, 1);
} else if (operation == OPERATION_SYNC) { } 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 */ /* we are reading from an incomplete sync */
/* The undeterminated hash are only for CHG/DELETED blocks for which we don't */ /* 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 */ /* 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 */ /* 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. */ /* 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); state_read(&state);

View file

@ -90,7 +90,7 @@ void state_init(struct snapraid_state* state)
state->lockfile[0] = 0; state->lockfile[0] = 0;
state->level = 1; /* default is the lowest protection */ state->level = 1; /* default is the lowest protection */
state->loaded_paritymax = 0; state->loaded_paritymax = 0;
state->clear_undeterminate_hash = 0; state->clear_past_hash = 0;
state->no_conf = 0; state->no_conf = 0;
tommy_list_init(&state->disklist); 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 */ /* if the block contains a hash of past data */
/* and we are clearing such undeterminated hashes */ /* and we are clearing such undeterminated hashes */
if (state->clear_undeterminate_hash if (state->clear_past_hash
&& block_has_past_hash(block) && block_has_past_hash(block)
) { ) {
/* set the hash value to INVALID */ /* 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 we are clearing undeterminated hashes */
if (state->clear_undeterminate_hash) { if (state->clear_past_hash) {
/* set the hash value to INVALID */ /* set the hash value to INVALID */
hash_invalid_set(deleted->block.hash); 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 */ /* if the block contains a hash of past data */
/* and we are clearing such undeterminated hashes */ /* and we are clearing such undeterminated hashes */
if (state->clear_undeterminate_hash if (state->clear_past_hash
&& block_has_past_hash(block) && block_has_past_hash(block)
) { ) {
/* set the hash value to INVALID */ /* 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 we are clearing undeterminated hashes */
if (state->clear_undeterminate_hash) { if (state->clear_past_hash) {
/* set the hash value to INVALID */ /* set the hash value to INVALID */
hash_invalid_set(deleted->block.hash); hash_invalid_set(deleted->block.hash);
} }

View file

@ -130,7 +130,7 @@ struct snapraid_state {
*/ */
block_off_t loaded_paritymax; 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_start; /**< Start of processing for progress visualization. */
time_t progress_last; /**< Last update of progress visualization. */ time_t progress_last; /**< Last update of progress visualization. */
time_t progress_interruption; /**< Start of the measure interruption. */ time_t progress_interruption; /**< Start of the measure interruption. */

View file

@ -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 */ /* the sync process assumes that all the hashes are correct */
/* including the ones from CHG and DELETED blocks */ /* including the ones from CHG and DELETED blocks */
assert(state->clear_undeterminate_hash != 0); assert(state->clear_past_hash != 0);
/* get the present time */ /* get the present time */
now = time(0); now = time(0);