Skip to content

Commit e65bb55

Browse files
Long Licmaiolino
authored andcommitted
xfs: factor out xfs_attr3_leaf_init
Factor out wrapper xfs_attr3_leaf_init function, which exported for external use. Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Long Li <leo.lilong@huawei.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent ce4e789 commit e65bb55

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,28 @@ xfs_attr3_leaf_create(
14151415
return 0;
14161416
}
14171417

1418+
/*
1419+
* Reinitialize an existing attr fork block as an empty leaf, and attach
1420+
* the buffer to tp.
1421+
*/
1422+
int
1423+
xfs_attr3_leaf_init(
1424+
struct xfs_trans *tp,
1425+
struct xfs_inode *dp,
1426+
xfs_dablk_t blkno)
1427+
{
1428+
struct xfs_buf *bp = NULL;
1429+
struct xfs_da_args args = {
1430+
.trans = tp,
1431+
.dp = dp,
1432+
.owner = dp->i_ino,
1433+
.geo = dp->i_mount->m_attr_geo,
1434+
};
1435+
1436+
ASSERT(tp != NULL);
1437+
1438+
return xfs_attr3_leaf_create(&args, blkno, &bp);
1439+
}
14181440
/*
14191441
* Split the leaf node, rebalance, then add the new entry.
14201442
*

fs/xfs/libxfs/xfs_attr_leaf.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
8787
/*
8888
* Routines used for shrinking the Btree.
8989
*/
90+
91+
int xfs_attr3_leaf_init(struct xfs_trans *tp, struct xfs_inode *dp,
92+
xfs_dablk_t blkno);
9093
int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
9194
void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
9295
struct xfs_da_state_blk *drop_blk,

0 commit comments

Comments
 (0)