[PATCH 054/110] xfs: remove xfs_allocbt_stage_cursor

Darrick J. Wong
2024-03-26T03:42:31Z

From: Christoph Hellwig <hch@lst.de>

Source kernel commit: 91796b2eef8bd725873bec326a7be830a68a11ff

Just open code the two calls in the callers.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
libxfs/libxfs_api_defs.h | 2 ++
libxfs/xfs_alloc_btree.c | 15 ---------------
libxfs/xfs_alloc_btree.h | 3 ---
repair/agbtree.c | 11 +++++++----
4 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
index 769733ec2ee3..9a2968906c42 100644
--- a/libxfs/libxfs_api_defs.h
+++ b/libxfs/libxfs_api_defs.h
@@ -26,6 +26,7 @@

#define xfs_alloc_ag_max_usable libxfs_alloc_ag_max_usable
#define xfs_allocbt_calc_size libxfs_allocbt_calc_size
+#define xfs_allocbt_init_cursor libxfs_allocbt_init_cursor
#define xfs_allocbt_maxlevels_ondisk libxfs_allocbt_maxlevels_ondisk
#define xfs_allocbt_maxrecs libxfs_allocbt_maxrecs
#define xfs_allocbt_stage_cursor libxfs_allocbt_stage_cursor
@@ -63,6 +64,7 @@
#define xfs_btree_del_cursor libxfs_btree_del_cursor
#define xfs_btree_init_block libxfs_btree_init_block
#define xfs_btree_rec_addr libxfs_btree_rec_addr
+#define xfs_btree_stage_afakeroot libxfs_btree_stage_afakeroot
#define xfs_buf_delwri_submit libxfs_buf_delwri_submit
#define xfs_buf_get libxfs_buf_get
#define xfs_buf_get_uncached libxfs_buf_get_uncached
diff --git a/libxfs/xfs_alloc_btree.c b/libxfs/xfs_alloc_btree.c
index 13d2310cfa36..bd7878b68931 100644
--- a/libxfs/xfs_alloc_btree.c
+++ b/libxfs/xfs_alloc_btree.c
@@ -546,21 +546,6 @@ xfs_allocbt_init_cursor(
return cur;
}

-/* Create a free space btree cursor with a fake root for staging. */
-struct xfs_btree_cur *
-xfs_allocbt_stage_cursor(
- struct xfs_mount *mp,
- struct xbtree_afakeroot *afake,
- struct xfs_perag *pag,
- xfs_btnum_t btnum)
-{
- struct xfs_btree_cur *cur;
-
- cur = xfs_allocbt_init_cursor(mp, NULL, NULL, pag, btnum);
- xfs_btree_stage_afakeroot(cur, afake);
- return cur;
-}
-
/*
* Install a new free space btree root. Caller is responsible for invalidating
* and freeing the old btree blocks.
diff --git a/libxfs/xfs_alloc_btree.h b/libxfs/xfs_alloc_btree.h
index 45df893ef6bb..1c910862535f 100644
--- a/libxfs/xfs_alloc_btree.h
+++ b/libxfs/xfs_alloc_btree.h
@@ -50,9 +50,6 @@ struct xbtree_afakeroot;
extern struct xfs_btree_cur *xfs_allocbt_init_cursor(struct xfs_mount *mp,
struct xfs_trans *tp, struct xfs_buf *bp,
struct xfs_perag *pag, xfs_btnum_t btnum);
-struct xfs_btree_cur *xfs_allocbt_stage_cursor(struct xfs_mount *mp,
- struct xbtree_afakeroot *afake, struct xfs_perag *pag,
- xfs_btnum_t btnum);
extern int xfs_allocbt_maxrecs(struct xfs_mount *, int, int);
extern xfs_extlen_t xfs_allocbt_calc_size(struct xfs_mount *mp,
unsigned long long len);
diff --git a/repair/agbtree.c b/repair/agbtree.c
index 38f3f7b8feac..d5fa4eafb633 100644
--- a/repair/agbtree.c
+++ b/repair/agbtree.c
@@ -262,10 +262,13 @@ init_freespace_cursors(
init_rebuild(sc, &XFS_RMAP_OINFO_AG, est_agfreeblocks, btr_bno);
init_rebuild(sc, &XFS_RMAP_OINFO_AG, est_agfreeblocks, btr_cnt);

- btr_bno->cur = libxfs_allocbt_stage_cursor(sc->mp,
- &btr_bno->newbt.afake, pag, XFS_BTNUM_BNO);
- btr_cnt->cur = libxfs_allocbt_stage_cursor(sc->mp,
- &btr_cnt->newbt.afake, pag, XFS_BTNUM_CNT);
+ btr_bno->cur = libxfs_allocbt_init_cursor(sc->mp, NULL, NULL, pag,
+ XFS_BTNUM_BNO);
+ libxfs_btree_stage_afakeroot(btr_bno->cur, &btr_bno->newbt.afake);
+
+ btr_cnt->cur = libxfs_allocbt_init_cursor(sc->mp, NULL, NULL, pag,
+ XFS_BTNUM_CNT);
+ libxfs_btree_stage_afakeroot(btr_cnt->cur, &btr_cnt->newbt.afake);

btr_bno->bload.get_records = get_bnobt_records;
btr_bno->bload.claim_block = rebuild_claim_block;