diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-09-16 21:25:32 +0200 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-10-19 20:45:15 +0200 |
commit | 56370ea6e5fe3e3d6e1ca2da58f95fb0d5e1779f (patch) | |
tree | 451401b83adf0d7f33a79fd96d791169b3fe2ee2 /fs/xfs/libxfs/xfs_btree.h | |
parent | xfs: rearrange xfs_btree_cur fields for better packing (diff) | |
download | linux-56370ea6e5fe3e3d6e1ca2da58f95fb0d5e1779f.tar.xz linux-56370ea6e5fe3e3d6e1ca2da58f95fb0d5e1779f.zip |
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.h | 16 |
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__ */ |