Skip to content

Commit de83915

Browse files
zhangyi089gregkh
authored andcommitted
ext4: move the calculation of wbc->nr_to_write to mpage_folio_done()
commit f922c8c upstream. mpage_folio_done() should be a more appropriate place than mpage_submit_folio() for updating the wbc->nr_to_write after we have submitted a fully mapped folio. Preparing to make mpage_submit_folio() allows to submit partially mapped folio that is still under processing. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Baokun Li <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent dc3588c commit de83915

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/ext4/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,7 @@ int ext4_da_get_block_prep(struct inode *inode, sector_t iblock,
20272027
static void mpage_folio_done(struct mpage_da_data *mpd, struct folio *folio)
20282028
{
20292029
mpd->start_pos += folio_size(folio);
2030+
mpd->wbc->nr_to_write -= folio_nr_pages(folio);
20302031
folio_unlock(folio);
20312032
}
20322033

@@ -2057,8 +2058,6 @@ static int mpage_submit_folio(struct mpage_da_data *mpd, struct folio *folio)
20572058
!ext4_verity_in_progress(mpd->inode))
20582059
len = size & (len - 1);
20592060
err = ext4_bio_write_folio(&mpd->io_submit, folio, len);
2060-
if (!err)
2061-
mpd->wbc->nr_to_write -= folio_nr_pages(folio);
20622061

20632062
return err;
20642063
}

0 commit comments

Comments
 (0)