[PATCH 06/10] xfs: consolidate btree block freeing tracepoints

Darrick J. Wong
2023-12-31T22:16:07Z

Don't waste tracepoint segment memory on per-btree block freeing
tracepoints when we can do it from the generic btree code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
include/xfs_trace.h | 3 +--
libxfs/xfs_btree.c | 2 ++
libxfs/xfs_refcount_btree.c | 2 --
libxfs/xfs_rmap_btree.c | 2 --
4 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/include/xfs_trace.h b/include/xfs_trace.h
index f172b61d6a5..98819653bcb 100644
--- a/include/xfs_trace.h
+++ b/include/xfs_trace.h
@@ -68,6 +68,7 @@
#define trace_xfs_btree_commit_ifakeroot(a) ((void) 0)
#define trace_xfs_btree_bload_level_geometry(a,b,c,d,e,f,g) ((void) 0)
#define trace_xfs_btree_bload_block(a,b,c,d,e,f) ((void) 0)
+#define trace_xfs_btree_free_block(...) ((void) 0)

#define trace_xfs_free_extent(a,b,c,d,e,f,g) ((void) 0)
#define trace_xfs_agf(a,b,c,d) ((void) 0)
@@ -256,7 +257,6 @@
#define trace_xfs_rmap_find_left_neighbor_result(...) ((void) 0)
#define trace_xfs_rmap_lookup_le_range_result(...) ((void) 0)

-#define trace_xfs_rmapbt_free_block(...) ((void) 0)
#define trace_xfs_rmapbt_alloc_block(...) ((void) 0)

#define trace_xfs_ag_resv_critical(...) ((void) 0)
@@ -276,7 +276,6 @@
#define trace_xfs_refcount_insert_error(...) ((void) 0)
#define trace_xfs_refcount_delete(...) ((void) 0)
#define trace_xfs_refcount_delete_error(...) ((void) 0)
-#define trace_xfs_refcountbt_free_block(...) ((void) 0)
#define trace_xfs_refcountbt_alloc_block(...) ((void) 0)
#define trace_xfs_refcount_rec_order_error(...) ((void) 0)

diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index 4b4099c5635..14587e52840 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -411,6 +411,8 @@ xfs_btree_free_block(
{
int error;

+ trace_xfs_btree_free_block(cur, bp);
+
error = cur->bc_ops->free_block(cur, bp);
if (!error) {
xfs_trans_binval(cur->bc_tp, bp);
diff --git a/libxfs/xfs_refcount_btree.c b/libxfs/xfs_refcount_btree.c
index ac1c3ab868e..67551df02bd 100644
--- a/libxfs/xfs_refcount_btree.c
+++ b/libxfs/xfs_refcount_btree.c
@@ -106,8 +106,6 @@ xfs_refcountbt_free_block(
struct xfs_agf *agf = agbp->b_addr;
xfs_fsblock_t fsbno = XFS_DADDR_TO_FSB(mp, xfs_buf_daddr(bp));

- trace_xfs_refcountbt_free_block(cur->bc_mp, cur->bc_ag.pag->pag_agno,
- XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno), 1);
be32_add_cpu(&agf->agf_refcount_blocks, -1);
xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_REFCOUNT_BLOCKS);
return xfs_free_extent_later(cur->bc_tp, fsbno, 1,
diff --git a/libxfs/xfs_rmap_btree.c b/libxfs/xfs_rmap_btree.c
index d6e2fc0a3f9..7966a3e6a47 100644
--- a/libxfs/xfs_rmap_btree.c
+++ b/libxfs/xfs_rmap_btree.c
@@ -123,8 +123,6 @@ xfs_rmapbt_free_block(
int error;

bno = xfs_daddr_to_agbno(cur->bc_mp, xfs_buf_daddr(bp));
- trace_xfs_rmapbt_free_block(cur->bc_mp, pag->pag_agno,
- bno, 1);
be32_add_cpu(&agf->agf_rmap_blocks, -1);
xfs_alloc_log_agf(cur->bc_tp, agbp, XFS_AGF_RMAP_BLOCKS);
error = xfs_alloc_put_freelist(pag, cur->bc_tp, agbp, NULL, bno, 1);