mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
With the nocopy option also remove hash info from previous sync.
If we want to disable the automatic hashing assumption of copy, we need also to remove any previous hash info already stored in the content file by previous sync commands run without the nocopy option.
This commit is contained in:
parent
f7a060f6ab
commit
e76441e789
2 changed files with 25 additions and 1 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue