From cdba43dea697fc34ee42d805f53463e872e4b089 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Sun, 19 Aug 2012 17:07:56 +0200 Subject: [PATCH] Fixes hard-links exclusion after the first one. --- HISTORY | 1 + scan.c | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index d1f6ef8d..da55c8ee 100644 --- a/HISTORY +++ b/HISTORY @@ -10,6 +10,7 @@ SnapRAID HISTORY limitation of having two seconds modification time precision. This a safe measure to be 100% sure to always detect file changes. * Autosave isn't triggered if we are near the end of the process. + * Fixed hard-links automatic exclusion after the first one. 1.11 2012/7 =========== diff --git a/scan.c b/scan.c index 7582dd37..7667451d 100644 --- a/scan.c +++ b/scan.c @@ -137,9 +137,7 @@ static void scan_file_insert(struct snapraid_state* state, struct snapraid_disk* disk->first_free_block = block_pos + 1; } - /* insert the file in the file containers */ - tommy_hashdyn_insert(&disk->inodeset, &file->nodeset, file, file_inode_hash(file->inode)); - tommy_hashdyn_insert(&disk->pathset, &file->pathset, file, file_path_hash(file->sub)); + /* note that the file is already added in the file hashtables */ tommy_list_insert_tail(&disk->filelist, &file->nodelist, file); } @@ -322,7 +320,11 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state, /* mark it as present */ file_flag_set(file, FILE_IS_PRESENT); - /* insert it in the delayed insert list */ + /* insert the file in the file hashtables, to allow to find duplicate hardlinks */ + tommy_hashdyn_insert(&disk->inodeset, &file->nodeset, file, file_inode_hash(file->inode)); + tommy_hashdyn_insert(&disk->pathset, &file->pathset, file, file_path_hash(file->sub)); + + /* insert the file in the delayed block allocation */ tommy_list_insert_tail(&scan->file_insert_list, &file->nodelist, file); }