f2fs: Pass a folio to set_nid()

All callers have a folio, so pass it in.  Removes two calls to
compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2025-03-31 21:12:47 +01:00 committed by Jaegeuk Kim
parent f92379289f
commit 66bca01bc5
2 changed files with 9 additions and 9 deletions

View File

@ -818,7 +818,7 @@ int f2fs_get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
goto release_pages;
}
set_nid(&parent->page, offset[i - 1], nids[i], i == 1);
set_nid(parent, offset[i - 1], nids[i], i == 1);
f2fs_alloc_nid_done(sbi, nids[i]);
done = true;
} else if (mode == LOOKUP_NODE_RA && i == level && level > 1) {
@ -1017,7 +1017,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
ret = truncate_dnode(&rdn);
if (ret < 0)
goto out_err;
if (set_nid(&folio->page, i, 0, false))
if (set_nid(folio, i, 0, false))
dn->node_changed = true;
}
} else {
@ -1031,7 +1031,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs,
rdn.nid = child_nid;
ret = truncate_nodes(&rdn, child_nofs, 0, depth - 1);
if (ret == (NIDS_PER_BLOCK + 1)) {
if (set_nid(&folio->page, i, 0, false))
if (set_nid(folio, i, 0, false))
dn->node_changed = true;
child_nofs += ret;
} else if (ret < 0 && ret != -ENOENT) {
@ -1097,7 +1097,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn,
err = truncate_dnode(dn);
if (err < 0)
goto fail;
if (set_nid(&folios[idx]->page, i, 0, false))
if (set_nid(folios[idx], i, 0, false))
dn->node_changed = true;
}
@ -1223,7 +1223,7 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)
if (offset[1] == 0 && get_nid(&folio->page, offset[0], true)) {
folio_lock(folio);
BUG_ON(folio->mapping != NODE_MAPPING(sbi));
set_nid(&folio->page, offset[0], 0, true);
set_nid(folio, offset[0], 0, true);
folio_unlock(folio);
}
offset[1] = 0;

View File

@ -367,17 +367,17 @@ static inline bool IS_DNODE(const struct page *node_page)
return true;
}
static inline int set_nid(struct page *p, int off, nid_t nid, bool i)
static inline int set_nid(struct folio *folio, int off, nid_t nid, bool i)
{
struct f2fs_node *rn = F2FS_NODE(p);
struct f2fs_node *rn = F2FS_NODE(&folio->page);
f2fs_wait_on_page_writeback(p, NODE, true, true);
f2fs_folio_wait_writeback(folio, NODE, true, true);
if (i)
rn->i.i_nid[off - NODE_DIR1_BLOCK] = cpu_to_le32(nid);
else
rn->in.nid[off] = cpu_to_le32(nid);
return set_page_dirty(p);
return folio_mark_dirty(folio);
}
static inline nid_t get_nid(struct page *p, int off, bool i)