From: Matthew Wilcox (Oracle) Date: Mon, 31 Mar 2025 20:10:31 +0000 (+0100) Subject: f2fs: Use a folio in commit_checkpoint() X-Git-Tag: v6.16-rc1~115^2~172 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=668c7a564823a825a87924c87147d202580c293c;p=thirdparty%2Fkernel%2Flinux.git f2fs: Use a folio in commit_checkpoint() Save four calls to compound_head(). Also remove the call to f2fs_wait_on_page_writeback() as this was already done by f2fs_grab_meta_folio() and writeback can't have restarted in the meantime since we hold the folio locked. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 7dbd7f33d807f..0305158afc415 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1407,30 +1407,28 @@ static void commit_checkpoint(struct f2fs_sb_info *sbi, }; /* - * filemap_get_folios_tag and lock_page again will take + * filemap_get_folios_tag and folio_lock again will take * some extra time. Therefore, f2fs_update_meta_pages and * f2fs_sync_meta_pages are combined in this function. */ - struct page *page = f2fs_grab_meta_page(sbi, blk_addr); + struct folio *folio = f2fs_grab_meta_folio(sbi, blk_addr); int err; - f2fs_wait_on_page_writeback(page, META, true, true); + memcpy(folio_address(folio), src, PAGE_SIZE); - memcpy(page_address(page), src, PAGE_SIZE); - - set_page_dirty(page); - if (unlikely(!clear_page_dirty_for_io(page))) + folio_mark_dirty(folio); + if (unlikely(!folio_clear_dirty_for_io(folio))) f2fs_bug_on(sbi, 1); /* writeout cp pack 2 page */ - err = __f2fs_write_meta_page(page, &wbc, FS_CP_META_IO); + err = __f2fs_write_meta_page(&folio->page, &wbc, FS_CP_META_IO); if (unlikely(err && f2fs_cp_error(sbi))) { - f2fs_put_page(page, 1); + f2fs_folio_put(folio, true); return; } f2fs_bug_on(sbi, err); - f2fs_put_page(page, 0); + f2fs_folio_put(folio, false); /* submit checkpoint (with barrier if NOBARRIER is not set) */ f2fs_submit_merged_write(sbi, META_FLUSH);