]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
f2fs: Hoist the page_folio() call to the start of f2fs_merge_page_bio()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 18 Feb 2025 05:51:54 +0000 (05:51 +0000)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 4 Mar 2025 17:02:26 +0000 (17:02 +0000)
Remove one call to compound_head() and a reference to page->mapping
by calling page_folio() early on.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c

index 383b97f302215dd66650493a07f51f721800e250..a7bd9b07235a5c31ceda61b81a4be31c6c4f925a 100644 (file)
@@ -888,6 +888,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)
        struct bio *bio = *fio->bio;
        struct page *page = fio->encrypted_page ?
                        fio->encrypted_page : fio->page;
+       struct folio *folio = page_folio(fio->page);
 
        if (!f2fs_is_valid_blkaddr(fio->sbi, fio->new_blkaddr,
                        __is_meta_io(fio) ? META_GENERIC : DATA_GENERIC))
@@ -901,8 +902,8 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)
 alloc_new:
        if (!bio) {
                bio = __bio_alloc(fio, BIO_MAX_VECS);
-               f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host,
-                               page_folio(fio->page)->index, fio, GFP_NOIO);
+               f2fs_set_bio_crypt_ctx(bio, folio->mapping->host,
+                               folio->index, fio, GFP_NOIO);
 
                add_bio_entry(fio->sbi, bio, page, fio->temp);
        } else {
@@ -911,8 +912,7 @@ alloc_new:
        }
 
        if (fio->io_wbc)
-               wbc_account_cgroup_owner(fio->io_wbc, page_folio(fio->page),
-                                        PAGE_SIZE);
+               wbc_account_cgroup_owner(fio->io_wbc, folio, folio_size(folio));
 
        inc_page_count(fio->sbi, WB_DATA_TYPE(page, false));