]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
f2fs: annotate lockless last_time[] accesses
authorCen Zhang <zzzccc427@gmail.com>
Wed, 6 May 2026 01:07:09 +0000 (09:07 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 22 Jun 2026 19:52:34 +0000 (19:52 +0000)
commitb952837f734c3a627877bf922408dac04588a643
tree1a7731dfa59503272fd8c3173c1e219ae372dfb6
parentdd3114870771562036fdcf5abe813956f36d224d
f2fs: annotate lockless last_time[] accesses

f2fs stores mount-wide activity timestamps in sbi->last_time[] and
samples them from background discard, GC, and balance paths without a
dedicated lock. The timestamps are used as best-effort heuristics to
decide whether background work should run now or sleep a bit longer.

The current helpers use plain loads and stores, so KCSAN can report races
between frequent foreground updates and background readers. Exact
freshness is not required here, but the intentional lockless accesses
should be marked explicitly.

Use WRITE_ONCE() in f2fs_update_time() and READ_ONCE() in
f2fs_time_over() and f2fs_time_to_wait(). This preserves the existing
heuristic behavior and avoids adding locking to hot paths.

Signed-off-by: Cen Zhang <zzzccc427@gmail.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h