]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
f2fs: flush plug periodically during GC to maximize readahead effect
authorDaeho Jeong <daehojeong@google.com>
Tue, 30 Dec 2025 17:38:45 +0000 (09:38 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 7 Jan 2026 03:17:06 +0000 (03:17 +0000)
commit7ec199117c32543e0fa8787a6eedd9126523a8d4
treea09eb2533cb45f6f029e1a82d878410ec0cfad41
parent572b1c6f2ade7afe687a385caccb717081ada070
f2fs: flush plug periodically during GC to maximize readahead effect

During the garbage collection process, F2FS submits readahead I/Os for
valid blocks. However, since the GC loop runs within a single plug scope
without intermediate flushing, these readahead I/Os often accumulate in
the block layer's plug list instead of being dispatched to the device
immediately.

Consequently, when the GC thread attempts to lock the page later, the
I/O might not have completed (or even started), leading to a "read try
and wait" scenario. This negates the benefit of readahead and causes
unnecessary delays in GC latency.

This patch addresses this issue by introducing an intermediate
blk_finish_plug() and blk_start_plug() pair within the GC loop. This
forces the dispatch of pending I/Os, ensuring that readahead pages are
fetched in time, thereby reducing GC latency.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/gc.c