summaryrefslogtreecommitdiff
path: root/fs/xfs/libxfs/xfs_btree.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-16 22:25:32 +0300
committerDarrick J. Wong <djwong@kernel.org>2021-10-19 21:45:15 +0300
commit56370ea6e5fe3e3d6e1ca2da58f95fb0d5e1779f (patch)
tree451401b83adf0d7f33a79fd96d791169b3fe2ee2 /fs/xfs/libxfs/xfs_btree.h
parent69724d920e7c30ca4421af615c499e92cfcc550b (diff)
downloadlinux-56370ea6e5fe3e3d6e1ca2da58f95fb0d5e1779f.tar.xz
xfs: refactor btree cursor allocation function
Refactor btree allocation to a common helper. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Chandan Babu R <chandan.babu@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_btree.h')
-rw-r--r--fs/xfs/libxfs/xfs_btree.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h
index eaffd8223ce6..8e78ede87b16 100644
--- a/fs/xfs/libxfs/xfs_btree.h
+++ b/fs/xfs/libxfs/xfs_btree.h
@@ -578,4 +578,20 @@ void xfs_btree_copy_keys(struct xfs_btree_cur *cur,
union xfs_btree_key *dst_key,
const union xfs_btree_key *src_key, int numkeys);
+static inline struct xfs_btree_cur *
+xfs_btree_alloc_cursor(
+ struct xfs_mount *mp,
+ struct xfs_trans *tp,
+ xfs_btnum_t btnum)
+{
+ struct xfs_btree_cur *cur;
+
+ cur = kmem_cache_zalloc(xfs_btree_cur_zone, GFP_NOFS | __GFP_NOFAIL);
+ cur->bc_tp = tp;
+ cur->bc_mp = mp;
+ cur->bc_btnum = btnum;
+
+ return cur;
+}
+
#endif /* __XFS_BTREE_H__ */