Re: [PATCH v1 2/5] f2fs: Accounting large folio subpages before bio submission

From: Chao Yu
Date: Tue Jan 06 2026 - 04:27:54 EST


On 1/5/2026 11:30 PM, Nanzhe Zhao wrote:
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@xxxxxxx>

Reviewed-by: Chao Yu <chao@xxxxxxxxxx>

Thanks,