]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: consolidate btree block allocation tracepoints
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:00:56 +0000 (10:00 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:37 +0000 (11:37 -0700)
Source kernel commit: 2ed0b2c7f33159825af1a1a83face66edb52348a

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

With this patch applied, two tracepoints are collapsed into one
tracepoint, with the following effects on objdump -hx xfs.ko output:

Before:

10 __tracepoints_ptrs 00000b38  0000000000000000  0000000000000000  001412f0  2**2
14 __tracepoints_strings 00005433  0000000000000000  0000000000000000  001689a0  2**5
29 __tracepoints 00010d30  0000000000000000  0000000000000000  0023fe00  2**5

After:

10 __tracepoints_ptrs 00000b34  0000000000000000  0000000000000000  001417b0  2**2
14 __tracepoints_strings 00005413  0000000000000000  0000000000000000  00168e80  2**5
29 __tracepoints 00010cd0  0000000000000000  0000000000000000  00240760  2**5

Column 3 is the section size in bytes; removing these two tracepoints
reduces the size of the ELF segments by 132 bytes.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
include/xfs_trace.h
libxfs/xfs_btree.c
libxfs/xfs_refcount_btree.c
libxfs/xfs_rmap_btree.c

index 98819653bcb03cbc6b6f1e5815b5bcc9aee80d9e..e7cbd0d9d41625795eb25d3055f62abdab962d4d 100644 (file)
@@ -69,6 +69,7 @@
 #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_btree_alloc_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)
 #define trace_xfs_rmap_find_left_neighbor_result(...)  ((void) 0)
 #define trace_xfs_rmap_lookup_le_range_result(...)     ((void) 0)
 
-#define trace_xfs_rmapbt_alloc_block(...)      ((void) 0)
-
 #define trace_xfs_ag_resv_critical(...)                ((void) 0)
 #define trace_xfs_ag_resv_needed(...)          ((void) 0)
 #define trace_xfs_ag_resv_free(...)            ((void) 0)
 #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_alloc_block(...)  ((void) 0)
 #define trace_xfs_refcount_rec_order_error(...)        ((void) 0)
 
 #define trace_xfs_refcount_lookup(...)         ((void) 0)
index fb36a3b69ea0d5233d57e4cdab4132e0522d32e5..3a2b627fd6bef88587e05f2e7c61e651ea1ac866 100644 (file)
@@ -2690,6 +2690,20 @@ error1:
        return error;
 }
 
+static inline int
+xfs_btree_alloc_block(
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *hint_block,
+       union xfs_btree_ptr             *new_block,
+       int                             *stat)
+{
+       int                             error;
+
+       error = cur->bc_ops->alloc_block(cur, hint_block, new_block, stat);
+       trace_xfs_btree_alloc_block(cur, new_block, *stat, error);
+       return error;
+}
+
 /*
  * Split cur/level block in half.
  * Return new block number and the key to its first
@@ -2733,7 +2747,7 @@ __xfs_btree_split(
        xfs_btree_buf_to_ptr(cur, lbp, &lptr);
 
        /* Allocate the new block. If we can't do it, we're toast. Give up. */
-       error = cur->bc_ops->alloc_block(cur, &lptr, &rptr, stat);
+       error = xfs_btree_alloc_block(cur, &lptr, &rptr, stat);
        if (error)
                goto error0;
        if (*stat == 0)
@@ -3013,7 +3027,7 @@ xfs_btree_new_iroot(
        pp = xfs_btree_ptr_addr(cur, 1, block);
 
        /* Allocate the new block. If we can't do it, we're toast. Give up. */
-       error = cur->bc_ops->alloc_block(cur, pp, &nptr, stat);
+       error = xfs_btree_alloc_block(cur, pp, &nptr, stat);
        if (error)
                goto error0;
        if (*stat == 0)
@@ -3113,7 +3127,7 @@ xfs_btree_new_root(
        cur->bc_ops->init_ptr_from_cur(cur, &rptr);
 
        /* Allocate the new block. If we can't do it, we're toast. Give up. */
-       error = cur->bc_ops->alloc_block(cur, &rptr, &lptr, stat);
+       error = xfs_btree_alloc_block(cur, &rptr, &lptr, stat);
        if (error)
                goto error0;
        if (*stat == 0)
index 67551df02bde5c223df95ea58646164e9e5a68ed..9a3c2270c254624c6b1915524996628bedcccab3 100644 (file)
@@ -76,8 +76,6 @@ xfs_refcountbt_alloc_block(
                                        xfs_refc_block(args.mp)));
        if (error)
                goto out_error;
-       trace_xfs_refcountbt_alloc_block(cur->bc_mp, cur->bc_ag.pag->pag_agno,
-                       args.agbno, 1);
        if (args.fsbno == NULLFSBLOCK) {
                *stat = 0;
                return 0;
index 7966a3e6a4743bbf6b99aae4a3de6a5c4b199c60..e894a22e087c2bae33581e41a3d23561a47d4ab8 100644 (file)
@@ -92,8 +92,6 @@ xfs_rmapbt_alloc_block(
                                       &bno, 1);
        if (error)
                return error;
-
-       trace_xfs_rmapbt_alloc_block(cur->bc_mp, pag->pag_agno, bno, 1);
        if (bno == NULLAGBLOCK) {
                *stat = 0;
                return 0;