]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
f2fs: Accounting large folio subpages before bio submission
authorNanzhe Zhao <nzzhao@126.com>
Mon, 5 Jan 2026 15:30:58 +0000 (23:30 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 7 Jan 2026 03:17:08 +0000 (03:17 +0000)
commitc0c589fa1d17fc13b3be1a4dd2ec62266c2a0659
treedf6a4db4f5a3ab1fa28ee7cc58f2c9161875614a
parent00feea1dfcea2cc7c22e58b6325f72637c6ea217
f2fs: Accounting large folio subpages before bio submission

In f2fs_read_data_large_folio(), read_pages_pending is incremented only
after the subpage has been added to the BIO.  With a heavily fragmented
file, each new subpage can force submission of the previous BIO.

If the BIO completes quickly, f2fs_finish_read_bio() may decrement
read_pages_pending to zero and call folio_end_read() while the read loop
is still processing other subpages of the same large folio.

Fix the ordering by incrementing read_pages_pending before any possible
BIO submission for the current subpage, matching the iomap ordering and
preventing premature folio_end_read().

Signed-off-by: Nanzhe Zhao <nzzhao@126.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c