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>
This commit is contained in:
Long Li 2026-03-17 09:51:54 +08:00 committed by Carlos Maiolino
parent ce4e789cf3
commit e65bb55d7f
2 changed files with 25 additions and 0 deletions

View File

@ -1415,6 +1415,28 @@ xfs_attr3_leaf_create(
return 0;
}
/*
* Reinitialize an existing attr fork block as an empty leaf, and attach
* the buffer to tp.
*/
int
xfs_attr3_leaf_init(
struct xfs_trans *tp,
struct xfs_inode *dp,
xfs_dablk_t blkno)
{
struct xfs_buf *bp = NULL;
struct xfs_da_args args = {
.trans = tp,
.dp = dp,
.owner = dp->i_ino,
.geo = dp->i_mount->m_attr_geo,
};
ASSERT(tp != NULL);
return xfs_attr3_leaf_create(&args, blkno, &bp);
}
/*
* Split the leaf node, rebalance, then add the new entry.
*

View File

@ -87,6 +87,9 @@ int xfs_attr3_leaf_list_int(struct xfs_buf *bp,
/*
* Routines used for shrinking the Btree.
*/
int xfs_attr3_leaf_init(struct xfs_trans *tp, struct xfs_inode *dp,
xfs_dablk_t blkno);
int xfs_attr3_leaf_toosmall(struct xfs_da_state *state, int *retval);
void xfs_attr3_leaf_unbalance(struct xfs_da_state *state,
struct xfs_da_state_blk *drop_blk,