Remove legacy in-place mtime_nsec migration in multithread scanner

This commit is contained in:
Andrea Mazzoleni 2026-08-16 22:07:41 +02:00
parent fd09e72816
commit c1fa9e23b6

View file

@ -774,14 +774,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
/* check if the file is not changed */
if (file->size == st->st_size
&& file->mtime_sec == st->st_mtime
&& (file->mtime_nsec == STAT_NSEC(st)
/*
* Always accept the stored value if it's STAT_NSEC_INVALID
* it happens when upgrading from an old version of SnapRAID
* not yet supporting the nanosecond field
*/
|| file->mtime_nsec == STAT_NSEC_INVALID
)
&& file->mtime_nsec == STAT_NSEC(st)
) {
/* check if multiple files have the same inode */
if (file_flag_has(file, FILE_IS_PRESENT)) {
@ -801,19 +794,6 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
/* mark as present */
file_flag_set(file, FILE_IS_PRESENT);
/*
* Update the nanoseconds mtime only if different
* to avoid unneeded updates
*/
if (file->mtime_nsec == STAT_NSEC_INVALID
&& STAT_NSEC(st) != file->mtime_nsec
) {
file->mtime_nsec = STAT_NSEC(st);
/* we have to save the new mtime */
scan->need_write = 1;
}
if (strcmp(file->sub, sub) != 0) {
/* if the path is different, it means a moved file with the same inode */
++scan->count_move;
@ -961,31 +941,11 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub,
/* check if the file is not changed */
if (file->size == st->st_size
&& file->mtime_sec == st->st_mtime
&& (file->mtime_nsec == STAT_NSEC(st)
/*
* Always accept the stored value if it's STAT_NSEC_INVALID
* it happens when upgrading from an old version of SnapRAID
* not yet supporting the nanosecond field
*/
|| file->mtime_nsec == STAT_NSEC_INVALID
)
&& file->mtime_nsec == STAT_NSEC(st)
) {
/* mark as present */
file_flag_set(file, FILE_IS_PRESENT);
/*
* Update the nano seconds mtime only if different
* to avoid unneeded updates
*/
if (file->mtime_nsec == STAT_NSEC_INVALID
&& STAT_NSEC(st) != STAT_NSEC_INVALID
) {
file->mtime_nsec = STAT_NSEC(st);
/* we have to save the new mtime */
scan->need_write = 1;
}
/* if when processing the disk we used the past inodes values */
if (has_past_inodes && file->inode != INODE_INVALID && st->st_ino != INODE_INVALID) {
/*