]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: factor out xfs_attr3_leaf_init
authorLong Li <leo.lilong@huawei.com>
Fri, 24 Apr 2026 14:13:04 +0000 (16:13 +0200)
committerAndrey Albershteyn <aalbersh@kernel.org>
Mon, 27 Apr 2026 11:40:32 +0000 (13:40 +0200)
Source kernel commit: e65bb55d7f8c2041c8fdb73cd29b0b4cad4ed847

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>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
libxfs/xfs_attr_leaf.c
libxfs/xfs_attr_leaf.h

index 90be21a3887642335eb937f148bd1b8e54979ad0..6aaa7ff10959d59aaf84b8d334fd1068f4581766 100644 (file)
@@ -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.
  *
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,