Skip to content

Commit 8591db2

Browse files
Matthew Wilcox (Oracle)Jaegeuk Kim
authored andcommitted
f2fs: Pass a folio to F2FS_NODE()
All callers now have a folio so pass it in Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent c07de75 commit 8591db2

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

fs/f2fs/f2fs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,9 +2051,9 @@ static inline struct f2fs_checkpoint *F2FS_CKPT(struct f2fs_sb_info *sbi)
20512051
return (struct f2fs_checkpoint *)(sbi->ckpt);
20522052
}
20532053

2054-
static inline struct f2fs_node *F2FS_NODE(const struct page *page)
2054+
static inline struct f2fs_node *F2FS_NODE(const struct folio *folio)
20552055
{
2056-
return (struct f2fs_node *)page_address(page);
2056+
return (struct f2fs_node *)folio_address(folio);
20572057
}
20582058

20592059
static inline struct f2fs_inode *F2FS_INODE(const struct folio *folio)
@@ -3051,7 +3051,7 @@ static inline void f2fs_radix_tree_insert(struct radix_tree_root *root,
30513051

30523052
static inline bool IS_INODE(const struct folio *folio)
30533053
{
3054-
struct f2fs_node *p = F2FS_NODE(&folio->page);
3054+
struct f2fs_node *p = F2FS_NODE(folio);
30553055

30563056
return RAW_IS_INODE(p);
30573057
}
@@ -3075,13 +3075,13 @@ static inline unsigned int get_dnode_base(struct inode *inode,
30753075
return 0;
30763076

30773077
return inode ? get_extra_isize(inode) :
3078-
offset_in_addr(&F2FS_NODE(&node_folio->page)->i);
3078+
offset_in_addr(&F2FS_NODE(node_folio)->i);
30793079
}
30803080

30813081
static inline __le32 *get_dnode_addr(struct inode *inode,
30823082
struct folio *node_folio)
30833083
{
3084-
return blkaddr_in_node(F2FS_NODE(&node_folio->page)) +
3084+
return blkaddr_in_node(F2FS_NODE(node_folio)) +
30853085
get_dnode_base(inode, node_folio);
30863086
}
30873087

fs/f2fs/inode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void __recover_inline_status(struct inode *inode, struct folio *ifolio)
119119
static
120120
bool f2fs_enable_inode_chksum(struct f2fs_sb_info *sbi, struct folio *folio)
121121
{
122-
struct f2fs_inode *ri = &F2FS_NODE(&folio->page)->i;
122+
struct f2fs_inode *ri = &F2FS_NODE(folio)->i;
123123

124124
if (!f2fs_sb_has_inode_chksum(sbi))
125125
return false;
@@ -136,7 +136,7 @@ bool f2fs_enable_inode_chksum(struct f2fs_sb_info *sbi, struct folio *folio)
136136

137137
static __u32 f2fs_inode_chksum(struct f2fs_sb_info *sbi, struct folio *folio)
138138
{
139-
struct f2fs_node *node = F2FS_NODE(&folio->page);
139+
struct f2fs_node *node = F2FS_NODE(folio);
140140
struct f2fs_inode *ri = &node->i;
141141
__le32 ino = node->footer.ino;
142142
__le32 gen = ri->i_generation;
@@ -173,7 +173,7 @@ bool f2fs_inode_chksum_verify(struct f2fs_sb_info *sbi, struct folio *folio)
173173
#endif
174174
return true;
175175

176-
ri = &F2FS_NODE(&folio->page)->i;
176+
ri = &F2FS_NODE(folio)->i;
177177
provided = le32_to_cpu(ri->i_inode_checksum);
178178
calculated = f2fs_inode_chksum(sbi, folio);
179179

@@ -187,7 +187,7 @@ bool f2fs_inode_chksum_verify(struct f2fs_sb_info *sbi, struct folio *folio)
187187

188188
void f2fs_inode_chksum_set(struct f2fs_sb_info *sbi, struct folio *folio)
189189
{
190-
struct f2fs_inode *ri = &F2FS_NODE(&folio->page)->i;
190+
struct f2fs_inode *ri = &F2FS_NODE(folio)->i;
191191

192192
if (!f2fs_enable_inode_chksum(sbi, folio))
193193
return;

fs/f2fs/node.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
10191019

10201020
f2fs_ra_node_pages(folio, ofs, NIDS_PER_BLOCK);
10211021

1022-
rn = F2FS_NODE(&folio->page);
1022+
rn = F2FS_NODE(folio);
10231023
if (depth < 3) {
10241024
for (i = ofs; i < NIDS_PER_BLOCK; i++, freed++) {
10251025
child_nid = le32_to_cpu(rn->in.nid[i]);
@@ -2789,7 +2789,7 @@ int f2fs_recover_xattr_data(struct inode *inode, struct folio *folio)
27892789

27902790
/* 3: update and set xattr node page dirty */
27912791
if (folio) {
2792-
memcpy(F2FS_NODE(&xfolio->page), F2FS_NODE(&folio->page),
2792+
memcpy(F2FS_NODE(xfolio), F2FS_NODE(folio),
27932793
VALID_XATTR_BLOCK_SIZE);
27942794
folio_mark_dirty(xfolio);
27952795
}
@@ -2894,7 +2894,7 @@ int f2fs_restore_node_summary(struct f2fs_sb_info *sbi,
28942894
if (IS_ERR(folio))
28952895
return PTR_ERR(folio);
28962896

2897-
rn = F2FS_NODE(&folio->page);
2897+
rn = F2FS_NODE(folio);
28982898
sum_entry->nid = rn->footer.nid;
28992899
sum_entry->version = 0;
29002900
sum_entry->ofs_in_node = 0;

fs/f2fs/node.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -245,39 +245,39 @@ static inline void set_to_next_nat(struct f2fs_nm_info *nm_i, nid_t start_nid)
245245

246246
static inline nid_t ino_of_node(const struct folio *node_folio)
247247
{
248-
struct f2fs_node *rn = F2FS_NODE(&node_folio->page);
248+
struct f2fs_node *rn = F2FS_NODE(node_folio);
249249
return le32_to_cpu(rn->footer.ino);
250250
}
251251

252252
static inline nid_t nid_of_node(const struct folio *node_folio)
253253
{
254-
struct f2fs_node *rn = F2FS_NODE(&node_folio->page);
254+
struct f2fs_node *rn = F2FS_NODE(node_folio);
255255
return le32_to_cpu(rn->footer.nid);
256256
}
257257

258258
static inline unsigned int ofs_of_node(const struct folio *node_folio)
259259
{
260-
struct f2fs_node *rn = F2FS_NODE(&node_folio->page);
260+
struct f2fs_node *rn = F2FS_NODE(node_folio);
261261
unsigned flag = le32_to_cpu(rn->footer.flag);
262262
return flag >> OFFSET_BIT_SHIFT;
263263
}
264264

265265
static inline __u64 cpver_of_node(const struct folio *node_folio)
266266
{
267-
struct f2fs_node *rn = F2FS_NODE(&node_folio->page);
267+
struct f2fs_node *rn = F2FS_NODE(node_folio);
268268
return le64_to_cpu(rn->footer.cp_ver);
269269
}
270270

271-
static inline block_t next_blkaddr_of_node(struct folio *node_folio)
271+
static inline block_t next_blkaddr_of_node(const struct folio *node_folio)
272272
{
273-
struct f2fs_node *rn = F2FS_NODE(&node_folio->page);
273+
struct f2fs_node *rn = F2FS_NODE(node_folio);
274274
return le32_to_cpu(rn->footer.next_blkaddr);
275275
}
276276

277277
static inline void fill_node_footer(const struct folio *folio, nid_t nid,
278278
nid_t ino, unsigned int ofs, bool reset)
279279
{
280-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
280+
struct f2fs_node *rn = F2FS_NODE(folio);
281281
unsigned int old_flag = 0;
282282

283283
if (reset)
@@ -296,15 +296,15 @@ static inline void fill_node_footer(const struct folio *folio, nid_t nid,
296296
static inline void copy_node_footer(const struct folio *dst,
297297
const struct folio *src)
298298
{
299-
struct f2fs_node *src_rn = F2FS_NODE(&src->page);
300-
struct f2fs_node *dst_rn = F2FS_NODE(&dst->page);
299+
struct f2fs_node *src_rn = F2FS_NODE(src);
300+
struct f2fs_node *dst_rn = F2FS_NODE(dst);
301301
memcpy(&dst_rn->footer, &src_rn->footer, sizeof(struct node_footer));
302302
}
303303

304304
static inline void fill_node_footer_blkaddr(struct folio *folio, block_t blkaddr)
305305
{
306306
struct f2fs_checkpoint *ckpt = F2FS_CKPT(F2FS_F_SB(folio));
307-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
307+
struct f2fs_node *rn = F2FS_NODE(folio);
308308
__u64 cp_ver = cur_cp_version(ckpt);
309309

310310
if (__is_set_ckpt_flags(ckpt, CP_CRC_RECOVERY_FLAG))
@@ -370,7 +370,7 @@ static inline bool IS_DNODE(const struct folio *node_folio)
370370

371371
static inline int set_nid(struct folio *folio, int off, nid_t nid, bool i)
372372
{
373-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
373+
struct f2fs_node *rn = F2FS_NODE(folio);
374374

375375
f2fs_folio_wait_writeback(folio, NODE, true, true);
376376

@@ -383,7 +383,7 @@ static inline int set_nid(struct folio *folio, int off, nid_t nid, bool i)
383383

384384
static inline nid_t get_nid(const struct folio *folio, int off, bool i)
385385
{
386-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
386+
struct f2fs_node *rn = F2FS_NODE(folio);
387387

388388
if (i)
389389
return le32_to_cpu(rn->i.i_nid[off - NODE_DIR1_BLOCK]);
@@ -399,7 +399,7 @@ static inline nid_t get_nid(const struct folio *folio, int off, bool i)
399399

400400
static inline int is_node(const struct folio *folio, int type)
401401
{
402-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
402+
struct f2fs_node *rn = F2FS_NODE(folio);
403403
return le32_to_cpu(rn->footer.flag) & BIT(type);
404404
}
405405

@@ -409,7 +409,7 @@ static inline int is_node(const struct folio *folio, int type)
409409

410410
static inline void set_cold_node(const struct folio *folio, bool is_dir)
411411
{
412-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
412+
struct f2fs_node *rn = F2FS_NODE(folio);
413413
unsigned int flag = le32_to_cpu(rn->footer.flag);
414414

415415
if (is_dir)
@@ -421,7 +421,7 @@ static inline void set_cold_node(const struct folio *folio, bool is_dir)
421421

422422
static inline void set_mark(struct folio *folio, int mark, int type)
423423
{
424-
struct f2fs_node *rn = F2FS_NODE(&folio->page);
424+
struct f2fs_node *rn = F2FS_NODE(folio);
425425
unsigned int flag = le32_to_cpu(rn->footer.flag);
426426
if (mark)
427427
flag |= BIT(type);

0 commit comments

Comments
 (0)