From: Long Li Date: Fri, 24 Apr 2026 14:13:04 +0000 (+0200) Subject: xfs: factor out xfs_attr3_leaf_init X-Git-Tag: v7.0.0~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=922f14a9b77638b4a3fc604169df6799d16f8fd7;p=xfsprogs-dev.git xfs: factor out xfs_attr3_leaf_init Source kernel commit: e65bb55d7f8c2041c8fdb73cd29b0b4cad4ed847 Factor out wrapper xfs_attr3_leaf_init function, which exported for external use. Reviewed-by: Darrick J. Wong Signed-off-by: Long Li Signed-off-by: Carlos Maiolino Signed-off-by: Andrey Albershteyn --- diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 90be21a3..6aaa7ff1 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -1412,6 +1412,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. * diff --git a/libxfs/xfs_attr_leaf.h b/libxfs/xfs_attr_leaf.h index aca46da2..72639efe 100644 --- a/libxfs/xfs_attr_leaf.h +++ b/libxfs/xfs_attr_leaf.h @@ -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,