Skip to content

Commit d194f11

Browse files
sigmanatureJaegeuk Kim
authored andcommitted
f2fs: advance index and offset after zeroing in large folio read
In f2fs_read_data_large_folio(), the block zeroing path calls folio_zero_range() and then continues the loop. However, it fails to advance index and offset before continuing. This can cause the loop to repeatedly process the same subpage of the folio, leading to stalls/hangs and incorrect progress when reading large folios with holes/zeroed blocks. Fix it by advancing index and offset unconditionally in the loop iteration, so they are updated even when the zeroing path continues. Signed-off-by: Nanzhe Zhao <nzzhao@126.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 6afd05c commit d194f11

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

fs/f2fs/data.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,7 @@ static int f2fs_read_data_large_folio(struct inode *inode,
24702470
ffs = NULL;
24712471
nrpages = folio_nr_pages(folio);
24722472

2473-
for (; nrpages; nrpages--, max_nr_pages--) {
2473+
for (; nrpages; nrpages--, max_nr_pages--, index++, offset++) {
24742474
sector_t block_nr;
24752475
/*
24762476
* Map blocks using the previous result first.
@@ -2555,8 +2555,6 @@ static int f2fs_read_data_large_folio(struct inode *inode,
25552555
f2fs_update_iostat(F2FS_I_SB(inode), NULL, FS_DATA_READ_IO,
25562556
F2FS_BLKSIZE);
25572557
last_block_in_bio = block_nr;
2558-
index++;
2559-
offset++;
25602558
}
25612559
trace_f2fs_read_folio(folio, DATA);
25622560
if (rac) {

0 commit comments

Comments
 (0)