]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: factor out xfs_attr3_leaf_init
authorLong Li <leo.lilong@huawei.com>
Tue, 17 Mar 2026 01:51:54 +0000 (09:51 +0800)
committerCarlos Maiolino <cem@kernel.org>
Mon, 23 Mar 2026 09:47:28 +0000 (10:47 +0100)
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>
fs/xfs/libxfs/xfs_attr_leaf.c
fs/xfs/libxfs/xfs_attr_leaf.h

index 47f48ae555c0398b51f84d06c4896f683d5ad2fc..2b78041e867232f97c56041568b8f599d44aec99 100644 (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.
  *
index aca46da2bc502ee672008bce8adf0152c3e0424f..72639efe6ac39ac810ea731d88e5fe25ed4a400e 100644 (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,