f2fs: Pass a folio to ADDRS_PER_PAGE()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 8 Jul 2025 17:03:33 +0000 (18:03 +0100)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 22 Jul 2025 15:56:59 +0000 (15:56 +0000)
All callers now have a folio so 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/data.c
fs/f2fs/file.c
fs/f2fs/recovery.c
fs/f2fs/segment.c
include/linux/f2fs_fs.h

index 0e261caf2f91e2416abb81b3e7fca167c9c342db..8a2414ce39ffa4b74e62116859787df1f9bab69c 100644 (file)
@@ -1588,7 +1588,7 @@ next_dnode:
        start_pgofs = pgofs;
        prealloc = 0;
        last_ofs_in_node = ofs_in_node = dn.ofs_in_node;
-       end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+       end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
 
 next_block:
        blkaddr = f2fs_data_blkaddr(&dn);
index 04a5a10893208279beb3eec1ec19c5068b25d7bf..60618c52ba50c2a107ec495ee44c750f260fc6c1 100644 (file)
@@ -489,7 +489,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
                        }
                }
 
-               end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+               end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
 
                /* find data/hole in dnode block */
                for (; dn.ofs_in_node < end_offset;
@@ -814,7 +814,7 @@ int f2fs_do_truncate_blocks(struct inode *inode, u64 from, bool lock)
                goto out;
        }
 
-       count = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+       count = ADDRS_PER_PAGE(dn.node_folio, inode);
 
        count -= dn.ofs_in_node;
        f2fs_bug_on(sbi, count < 0);
@@ -1233,7 +1233,7 @@ int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
                        return err;
                }
 
-               end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+               end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
                count = min(end_offset - dn.ofs_in_node, pg_end - pg_start);
 
                f2fs_bug_on(F2FS_I_SB(inode), count == 0 || count > end_offset);
@@ -1332,7 +1332,7 @@ next_dnode:
                goto next;
        }
 
-       done = min((pgoff_t)ADDRS_PER_PAGE(&dn.node_folio->page, inode) -
+       done = min((pgoff_t)ADDRS_PER_PAGE(dn.node_folio, inode) -
                                                        dn.ofs_in_node, len);
        for (i = 0; i < done; i++, blkaddr++, do_replace++, dn.ofs_in_node++) {
                *blkaddr = f2fs_data_blkaddr(&dn);
@@ -1421,7 +1421,7 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
                        }
 
                        ilen = min((pgoff_t)
-                               ADDRS_PER_PAGE(&dn.node_folio->page, dst_inode) -
+                               ADDRS_PER_PAGE(dn.node_folio, dst_inode) -
                                                dn.ofs_in_node, len - i);
                        do {
                                dn.data_blkaddr = f2fs_data_blkaddr(&dn);
@@ -1717,7 +1717,7 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len,
                                goto out;
                        }
 
-                       end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+                       end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
                        end = min(pg_end, end_offset - dn.ofs_in_node + index);
 
                        ret = f2fs_do_zero_range(&dn, index, end);
@@ -3885,7 +3885,7 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
                        break;
                }
 
-               end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+               end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
                count = min(end_offset - dn.ofs_in_node, last_idx - page_idx);
                count = round_up(count, fi->i_cluster_size);
 
@@ -4063,7 +4063,7 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)
                        break;
                }
 
-               end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+               end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
                count = min(end_offset - dn.ofs_in_node, last_idx - page_idx);
                count = round_up(count, fi->i_cluster_size);
 
@@ -4227,7 +4227,7 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg)
                        goto out;
                }
 
-               end_offset = ADDRS_PER_PAGE(&dn.node_folio->page, inode);
+               end_offset = ADDRS_PER_PAGE(dn.node_folio, inode);
                count = min(end_offset - dn.ofs_in_node, pg_end - index);
                for (i = 0; i < count; i++, index++, dn.ofs_in_node++) {
                        struct block_device *cur_bdev;
index 5a45d0d1f05c28f95dcda321621e395dbb0dcd37..894b27b0329d0c0635d99d30a6eebb4330ab5e81 100644 (file)
@@ -527,7 +527,7 @@ got_it:
        nid = le32_to_cpu(sum.nid);
        ofs_in_node = le16_to_cpu(sum.ofs_in_node);
 
-       max_addrs = ADDRS_PER_PAGE(&dn->node_folio->page, dn->inode);
+       max_addrs = ADDRS_PER_PAGE(dn->node_folio, dn->inode);
        if (ofs_in_node >= max_addrs) {
                f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%lu, nid:%u, max:%u",
                        ofs_in_node, dn->inode->i_ino, nid, max_addrs);
@@ -649,7 +649,7 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
 
        /* step 3: recover data indices */
        start = f2fs_start_bidx_of_node(ofs_of_node(folio), inode);
-       end = start + ADDRS_PER_PAGE(&folio->page, inode);
+       end = start + ADDRS_PER_PAGE(folio, inode);
 
        set_new_dnode(&dn, inode, NULL, NULL, 0);
 retry_dn:
index 2a6dcfba911fdd13b553f03f9fed2f46311d6836..909637873ff7b633cc501253c1e72c1dbbdad76f 100644 (file)
@@ -334,7 +334,7 @@ static int __f2fs_commit_atomic_write(struct inode *inode)
                        goto next;
                }
 
-               blen = min((pgoff_t)ADDRS_PER_PAGE(&dn.node_folio->page, cow_inode),
+               blen = min((pgoff_t)ADDRS_PER_PAGE(dn.node_folio, cow_inode),
                                len);
                index = off;
                for (i = 0; i < blen; i++, dn.ofs_in_node++, index++) {
index 5206d63b33860bfdc0bba5622f537759e4bfbcf7..25857877eaec08d91ecf5ebd289b037f69337bc5 100644 (file)
@@ -268,7 +268,7 @@ struct node_footer {
 /* Node IDs in an Indirect Block */
 #define NIDS_PER_BLOCK         ((F2FS_BLKSIZE - sizeof(struct node_footer)) / sizeof(__le32))
 
-#define ADDRS_PER_PAGE(page, inode)    (addrs_per_page(inode, IS_INODE(page)))
+#define ADDRS_PER_PAGE(folio, inode)   (addrs_per_page(inode, IS_INODE(&folio->page)))
 
 #define        NODE_DIR1_BLOCK         (DEF_ADDRS_PER_INODE + 1)
 #define        NODE_DIR2_BLOCK         (DEF_ADDRS_PER_INODE + 2)