diff options
author | Dave Chinner <dchinner@redhat.com> | 2023-05-09 11:29:42 +0200 |
---|---|---|
committer | Carlos Maiolino <cem@kernel.org> | 2023-05-10 08:23:34 +0200 |
commit | 35398d0d644ffb50f3146564e62f8c23ad2bcb6b (patch) | |
tree | ea538b8d297ee00a5120585c27d3df228379ecfe | |
parent | 7ab297988a0b0011688d81835bf8e9bd7b95bdb3 (diff) | |
download | xfsprogs-dev-35398d0d644ffb50f3146564e62f8c23ad2bcb6b.tar.gz |
xfs: rework the perag trace points to be perag centric
Source kernel commit: 368e2d09b41caa5b44a61bb518c362f46d6d615c
So that they all output the same information in the traces to make
debugging refcount issues easier.
This means that all the lookup/drop functions no longer need to use
the full memory barrier atomic operations (atomic*_return()) so
will have less overhead when tracing is off. The set/clear tag
tracepoints no longer abuse the reference count to pass the tag -
the tag being cleared is obvious from the _RET_IP_ that is recorded
in the trace point.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
-rw-r--r-- | include/xfs_trace.h | 11 | ||||
-rw-r--r-- | libxfs/xfs_ag.c | 25 |
2 files changed, 12 insertions, 24 deletions
diff --git a/include/xfs_trace.h b/include/xfs_trace.h index 65c2a225ec..c9398c4d89 100644 --- a/include/xfs_trace.h +++ b/include/xfs_trace.h @@ -181,11 +181,11 @@ /* set c = c to avoid unused var warnings */ #define trace_xfs_write_extent(a,b,c,d) ((c) = (c)) -#define trace_xfs_perag_get(a,b,c,d) ((c) = (c)) -#define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c)) +#define trace_xfs_perag_get(c,d) ((c) = (c)) +#define trace_xfs_perag_get_tag(c,d) ((c) = (c)) #define trace_xfs_perag_grab(...) ((void) 0) #define trace_xfs_perag_grab_tag(...) ((void) 0) -#define trace_xfs_perag_put(a,b,c,d) ((c) = (c)) +#define trace_xfs_perag_put(c,d) ((c) = (c)) #define trace_xfs_perag_rele(...) ((void) 0) #define trace_xfs_trans_alloc(a,b) ((void) 0) @@ -326,9 +326,4 @@ #define trace_xfs_fs_mark_healthy(a,b) ((void) 0) -/* set c = c to avoid unused var warnings */ -#define trace_xfs_perag_get(a,b,c,d) ((c) = (c)) -#define trace_xfs_perag_get_tag(a,b,c,d) ((c) = (c)) -#define trace_xfs_perag_put(a,b,c,d) ((c) = (c)) - #endif /* __TRACE_H__ */ diff --git a/libxfs/xfs_ag.c b/libxfs/xfs_ag.c index 19a5e5dc84..1b0e03502d 100644 --- a/libxfs/xfs_ag.c +++ b/libxfs/xfs_ag.c @@ -42,16 +42,15 @@ xfs_perag_get( xfs_agnumber_t agno) { struct xfs_perag *pag; - int ref = 0; rcu_read_lock(); pag = radix_tree_lookup(&mp->m_perag_tree, agno); if (pag) { + trace_xfs_perag_get(pag, _RET_IP_); ASSERT(atomic_read(&pag->pag_ref) >= 0); - ref = atomic_inc_return(&pag->pag_ref); + atomic_inc(&pag->pag_ref); } rcu_read_unlock(); - trace_xfs_perag_get(mp, agno, ref, _RET_IP_); return pag; } @@ -66,7 +65,6 @@ xfs_perag_get_tag( { struct xfs_perag *pag; int found; - int ref; rcu_read_lock(); found = radix_tree_gang_lookup_tag(&mp->m_perag_tree, @@ -75,9 +73,9 @@ xfs_perag_get_tag( rcu_read_unlock(); return NULL; } - ref = atomic_inc_return(&pag->pag_ref); + trace_xfs_perag_get_tag(pag, _RET_IP_); + atomic_inc(&pag->pag_ref); rcu_read_unlock(); - trace_xfs_perag_get_tag(mp, pag->pag_agno, ref, _RET_IP_); return pag; } @@ -85,11 +83,9 @@ void xfs_perag_put( struct xfs_perag *pag) { - int ref; - + trace_xfs_perag_put(pag, _RET_IP_); ASSERT(atomic_read(&pag->pag_ref) > 0); - ref = atomic_dec_return(&pag->pag_ref); - trace_xfs_perag_put(pag->pag_mount, pag->pag_agno, ref, _RET_IP_); + atomic_dec(&pag->pag_ref); } /* @@ -108,8 +104,7 @@ xfs_perag_grab( rcu_read_lock(); pag = radix_tree_lookup(&mp->m_perag_tree, agno); if (pag) { - trace_xfs_perag_grab(mp, pag->pag_agno, - atomic_read(&pag->pag_active_ref), _RET_IP_); + trace_xfs_perag_grab(pag, _RET_IP_); if (!atomic_inc_not_zero(&pag->pag_active_ref)) pag = NULL; } @@ -136,8 +131,7 @@ xfs_perag_grab_tag( rcu_read_unlock(); return NULL; } - trace_xfs_perag_grab_tag(mp, pag->pag_agno, - atomic_read(&pag->pag_active_ref), _RET_IP_); + trace_xfs_perag_grab_tag(pag, _RET_IP_); if (!atomic_inc_not_zero(&pag->pag_active_ref)) pag = NULL; rcu_read_unlock(); @@ -148,8 +142,7 @@ void xfs_perag_rele( struct xfs_perag *pag) { - trace_xfs_perag_rele(pag->pag_mount, pag->pag_agno, - atomic_read(&pag->pag_active_ref), _RET_IP_); + trace_xfs_perag_rele(pag, _RET_IP_); if (atomic_dec_and_test(&pag->pag_active_ref)) wake_up(&pag->pag_active_wq); } |