f2fs: Pass a folio to f2fs_allocate_data_block()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 8 Jul 2025 17:03:13 +0000 (18:03 +0100)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 22 Jul 2025 15:56:03 +0000 (15:56 +0000)
Most callers pass NULL, and the one which passes a page already has a
folio, so we can pass it in.

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/f2fs.h
fs/f2fs/segment.c

index f6a295d61d2b5ff868ce557410dcde60d86221d8..008d92dcbbceaf9a9e61d5f117e0a7b0f6fcbfda 100644 (file)
@@ -3858,7 +3858,7 @@ void f2fs_replace_block(struct f2fs_sb_info *sbi, struct dnode_of_data *dn,
                        bool recover_newaddr);
 enum temp_type f2fs_get_segment_temp(struct f2fs_sb_info *sbi,
                                                enum log_type seg_type);
-int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
+int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct folio *folio,
                        block_t old_blkaddr, block_t *new_blkaddr,
                        struct f2fs_summary *sum, int type,
                        struct f2fs_io_info *fio);
index df5a1e226aa9da2fc067439dd5f3a9299d526ac6..ca154a80778f86dc5aba36acff489aa22f68be4f 100644 (file)
@@ -3747,7 +3747,7 @@ static void f2fs_randomize_chunk(struct f2fs_sb_info *sbi,
                get_random_u32_inclusive(1, sbi->max_fragment_hole);
 }
 
-int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
+int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct folio *folio,
                block_t old_blkaddr, block_t *new_blkaddr,
                struct f2fs_summary *sum, int type,
                struct f2fs_io_info *fio)
@@ -3851,10 +3851,10 @@ skip_new_segment:
 
        up_write(&sit_i->sentry_lock);
 
-       if (page && IS_NODESEG(curseg->seg_type)) {
-               fill_node_footer_blkaddr(page, NEXT_FREE_BLKADDR(sbi, curseg));
+       if (folio && IS_NODESEG(curseg->seg_type)) {
+               fill_node_footer_blkaddr(&folio->page, NEXT_FREE_BLKADDR(sbi, curseg));
 
-               f2fs_inode_chksum_set(sbi, page);
+               f2fs_inode_chksum_set(sbi, &folio->page);
        }
 
        if (fio) {
@@ -3941,7 +3941,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
        if (keep_order)
                f2fs_down_read(&fio->sbi->io_order_lock);
 
-       if (f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
+       if (f2fs_allocate_data_block(fio->sbi, folio, fio->old_blkaddr,
                        &fio->new_blkaddr, sum, type, fio)) {
                if (fscrypt_inode_uses_fs_layer_crypto(folio->mapping->host))
                        fscrypt_finalize_bounce_page(&fio->encrypted_page);