f2fs_read_data_large_folio() can build a single read BIO across multiple
folios during readahead. If a folio ends up having none of its subpages
added to the BIO (e.g. all subpages are zeroed / treated as holes), it
will never be seen by f2fs_finish_read_bio(), so folio_end_read() is
never called. This leaves the folio locked and not marked uptodate.
Track whether the current folio has been added to a BIO via a local
'folio_in_bio' bool flag, and when iterating readahead folios, explicitly
mark the folio uptodate (on success) and unlock it when nothing was added.
Signed-off-by: Nanzhe Zhao <nzzhao@126.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
unsigned nrpages;
struct f2fs_folio_state *ffs;
int ret = 0;
+ bool folio_in_bio;
if (!IS_IMMUTABLE(inode))
return -EOPNOTSUPP;
if (!folio)
goto out;
+ folio_in_bio = false;
index = folio->index;
offset = 0;
ffs = NULL;
offset << PAGE_SHIFT))
goto submit_and_realloc;
+ folio_in_bio = true;
inc_page_count(F2FS_I_SB(inode), F2FS_RD_DATA);
f2fs_update_iostat(F2FS_I_SB(inode), NULL, FS_DATA_READ_IO,
F2FS_BLKSIZE);
}
trace_f2fs_read_folio(folio, DATA);
if (rac) {
+ if (!folio_in_bio) {
+ folio_mark_uptodate(folio);
+ folio_unlock(folio);
+ }
folio = readahead_folio(rac);
goto next_folio;
}