Clarify metadata validation semantics in sync comments

This commit is contained in:
Andrea Mazzoleni 2026-08-27 23:59:27 +02:00
parent 299ed704b5
commit 0483de15d2

View file

@ -187,7 +187,10 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */
} }
/* check if the file is changed */ /*
* Check if the file changed between scan and open. Stat info is cached
* on open; further changes will be detected in the next sync by mtime.
*/
if (handle[j].st.st_size != file->size if (handle[j].st.st_size != file->size
|| handle[j].st.st_mtime != file->mtime_sec || handle[j].st.st_mtime != file->mtime_sec
|| STAT_NSEC(&handle[j].st) != file->mtime_nsec || STAT_NSEC(&handle[j].st) != file->mtime_nsec
@ -209,8 +212,8 @@ static int state_hash_process(struct snapraid_state* state, block_off_t blocksta
++soft_error; ++soft_error;
/* /*
* If the file is changed, it means that it was modified during sync * File changed between scan and open; this isn't a serious error,
* this isn't a serious error, so we skip this block, and continue with others * so we skip this block, and continue with others
*/ */
continue; continue;
} }
@ -562,7 +565,10 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
/* LCOV_EXCL_STOP */ /* LCOV_EXCL_STOP */
} }
/* check if the file is changed */ /*
* Check if the file changed between scan and open. Stat info is cached
* on open; further changes will be detected in the next sync by mtime.
*/
if (handle->st.st_size != task->file->size if (handle->st.st_size != task->file->size
|| handle->st.st_mtime != task->file->mtime_sec || handle->st.st_mtime != task->file->mtime_sec
|| STAT_NSEC(&handle->st) != task->file->mtime_nsec || STAT_NSEC(&handle->st) != task->file->mtime_nsec
@ -580,8 +586,8 @@ static void sync_data_reader(struct snapraid_worker* worker, struct snapraid_tas
log_error_errno(ENOENT, disk->name); /* same message for ENOENT */ log_error_errno(ENOENT, disk->name); /* same message for ENOENT */
/* /*
* If the file is changed, it means that it was modified during sync * File changed between scan and open; this isn't a serious error,
* this isn't a serious error, so we skip this block, and continue with others * so we skip this block, and continue with others
*/ */
task->state = TASK_STATE_ERROR_CONTINUE; task->state = TASK_STATE_ERROR_CONTINUE;
return; return;