From 6904abced9f0698dba679b081f757aa6882fa52a Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 9 May 2023 11:32:43 +0200 Subject: [PATCH] xfs: add tracepoints for each of the externally visible allocators Source kernel commit: e6fbb7167ed005783ac5aef3e75699f45ffe2af8 There are now five separate space allocator interfaces exposed to the rest of XFS for five different strategies to find space. Add tracepoints for each of them so that I can tell from a trace dump exactly which ones got called and what happened underneath them. Add a sixth so it's more obvious if an allocation actually happened. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Carlos Maiolino --- include/xfs_trace.h | 6 ++++++ libxfs/xfs_alloc.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/xfs_trace.h b/include/xfs_trace.h index c9398c4d8..4facca264 100644 --- a/include/xfs_trace.h +++ b/include/xfs_trace.h @@ -35,6 +35,12 @@ #define trace_xfs_alloc_small_error(a) ((void) 0) #define trace_xfs_alloc_vextent_badargs(a) ((void) 0) #define trace_xfs_alloc_vextent_skip_deadlock(...) ((void) 0) +#define trace_xfs_alloc_vextent_finish(...) ((void) 0) +#define trace_xfs_alloc_vextent_this_ag(...) ((void) 0) +#define trace_xfs_alloc_vextent_first_ag(...) ((void) 0) +#define trace_xfs_alloc_vextent_start_ag(...) ((void) 0) +#define trace_xfs_alloc_vextent_near_bno(...) ((void) 0) +#define trace_xfs_alloc_vextent_exact_bno(...) ((void) 0) #define trace_xfs_alloc_vextent_nofix(a) ((void) 0) #define trace_xfs_alloc_vextent_noagbp(a) ((void) 0) #define trace_xfs_alloc_vextent_loopfailed(a) ((void) 0) diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index bd78e1bd4..daae044e2 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -3251,6 +3251,8 @@ xfs_alloc_vextent_finish( XFS_STATS_INC(mp, xs_allocx); XFS_STATS_ADD(mp, xs_allocb, args->len); + trace_xfs_alloc_vextent_finish(args); + out_drop_perag: if (drop_perag && args->pag) { xfs_perag_rele(args->pag); @@ -3280,6 +3282,9 @@ xfs_alloc_vextent_this_ag( args->agno = agno; args->agbno = 0; + + trace_xfs_alloc_vextent_this_ag(args); + error = xfs_alloc_vextent_check_args(args, XFS_AGB_TO_FSB(mp, agno, 0), &minimum_agno); if (error) { @@ -3401,6 +3406,9 @@ xfs_alloc_vextent_start_ag( args->agno = NULLAGNUMBER; args->agbno = NULLAGBLOCK; + + trace_xfs_alloc_vextent_first_ag(args); + error = xfs_alloc_vextent_check_args(args, target, &minimum_agno); if (error) { if (error == -ENOSPC) @@ -3451,6 +3459,9 @@ xfs_alloc_vextent_first_ag( args->agno = NULLAGNUMBER; args->agbno = NULLAGBLOCK; + + trace_xfs_alloc_vextent_start_ag(args); + error = xfs_alloc_vextent_check_args(args, target, &minimum_agno); if (error) { if (error == -ENOSPC) @@ -3482,6 +3493,9 @@ xfs_alloc_vextent_exact_bno( args->agno = XFS_FSB_TO_AGNO(mp, target); args->agbno = XFS_FSB_TO_AGBNO(mp, target); + + trace_xfs_alloc_vextent_near_bno(args); + error = xfs_alloc_vextent_check_args(args, target, &minimum_agno); if (error) { if (error == -ENOSPC) @@ -3517,6 +3531,9 @@ xfs_alloc_vextent_near_bno( args->agno = XFS_FSB_TO_AGNO(mp, target); args->agbno = XFS_FSB_TO_AGBNO(mp, target); + + trace_xfs_alloc_vextent_exact_bno(args); + error = xfs_alloc_vextent_check_args(args, target, &minimum_agno); if (error) { if (error == -ENOSPC) -- 2.47.2