diff --git a/cmdline/scan.c b/cmdline/scan.c index 1b71a32f..b0c7014d 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -602,7 +602,7 @@ static void scan_file(struct snapraid_scan* scan, int output, const char* sub, c add_insert = 0; add_change = 0; - /* then try findind it by name */ + /* then try finding it by name */ file = tommy_hashdyn_search(&disk->pathset, file_path_compare_to_arg, sub, file_path_hash(sub)); if (file) { /* if the file is without an inode */ diff --git a/cmdline/state.c b/cmdline/state.c index b7dc2997..9a3f15f4 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -1340,6 +1340,18 @@ static void state_read_text(struct snapraid_state* state, const char* path, STRE hash_invalid_set(block->hash); } + /* if we are disabling the copy optimization */ + /* we want also to clear any already previously stored information */ + /* in other sync commands */ + if (state->opt.force_nocopy + && block_state_get(block) == BLOCK_STATE_REP + ) { + /* set the hash value to INVALID */ + hash_invalid_set(block->hash); + /* convert from REP to CHG block */ + block_state_set(block, BLOCK_STATE_CHG); + } + /* we must not overwrite existing blocks */ if (disk_block_get(disk, v_pos) != BLOCK_EMPTY) { /* LCOV_EXCL_START */ @@ -2827,6 +2839,18 @@ static void state_read_binary(struct snapraid_state* state, const char* path, ST hash_invalid_set(block->hash); } + /* if we are disabling the copy optimization */ + /* we want also to clear any already previously stored information */ + /* in other sync commands */ + if (state->opt.force_nocopy + && block_state_get(block) == BLOCK_STATE_REP + ) { + /* set the hash value to INVALID */ + hash_invalid_set(block->hash); + /* convert from REP to CHG block */ + block_state_set(block, BLOCK_STATE_CHG); + } + /* we must not overwrite existing blocks */ if (disk_block_get(disk, v_pos) != BLOCK_EMPTY) { /* LCOV_EXCL_START */