From 20ec197bfa13c5b799fc9527790ea7b5374fc8f2 Mon Sep 17 00:00:00 2001 From: David Howells Date: Mon, 29 Mar 2021 13:53:50 +0100 Subject: fscache: Use refcount_t for the cookie refcount instead of atomic_t Use refcount_t for the fscache_cookie refcount instead of atomic_t and rename the 'usage' member to 'ref' in such cases. The tracepoints that reference it change from showing "u=%d" to "r=%d". Signed-off-by: David Howells Reviewed-by: Jeff Layton cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/162431204358.2908479.8006938388213098079.stgit@warthog.procyon.org.uk/ --- include/linux/fscache.h | 2 +- include/trace/events/fscache.h | 44 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/linux/fscache.h b/include/linux/fscache.h index ea61e54a6bc5..a4dab5998613 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h @@ -123,7 +123,7 @@ struct fscache_netfs { * - indices are created on disk just-in-time */ struct fscache_cookie { - atomic_t usage; /* number of users of this cookie */ + refcount_t ref; /* number of users of this cookie */ atomic_t n_children; /* number of children of this cookie */ atomic_t n_active; /* number of active users of netfs ptrs */ unsigned int debug_id; diff --git a/include/trace/events/fscache.h b/include/trace/events/fscache.h index 19d65d9d4357..446392f5ba83 100644 --- a/include/trace/events/fscache.h +++ b/include/trace/events/fscache.h @@ -161,26 +161,26 @@ fscache_cookie_traces; TRACE_EVENT(fscache_cookie, TP_PROTO(unsigned int cookie_debug_id, - int usage, + int ref, enum fscache_cookie_trace where), - TP_ARGS(cookie_debug_id, usage, where), + TP_ARGS(cookie_debug_id, ref, where), TP_STRUCT__entry( __field(unsigned int, cookie ) __field(enum fscache_cookie_trace, where ) - __field(int, usage ) + __field(int, ref ) ), TP_fast_assign( __entry->cookie = cookie_debug_id; __entry->where = where; - __entry->usage = usage; + __entry->ref = ref; ), - TP_printk("%s c=%08x u=%d", + TP_printk("%s c=%08x r=%d", __print_symbolic(__entry->where, fscache_cookie_traces), - __entry->cookie, __entry->usage) + __entry->cookie, __entry->ref) ); TRACE_EVENT(fscache_netfs, @@ -212,7 +212,7 @@ TRACE_EVENT(fscache_acquire, __field(unsigned int, cookie ) __field(unsigned int, parent ) __array(char, name, 8 ) - __field(int, p_usage ) + __field(int, p_ref ) __field(int, p_n_children ) __field(u8, p_flags ) ), @@ -220,15 +220,15 @@ TRACE_EVENT(fscache_acquire, TP_fast_assign( __entry->cookie = cookie->debug_id; __entry->parent = cookie->parent->debug_id; - __entry->p_usage = atomic_read(&cookie->parent->usage); + __entry->p_ref = refcount_read(&cookie->parent->ref); __entry->p_n_children = atomic_read(&cookie->parent->n_children); __entry->p_flags = cookie->parent->flags; memcpy(__entry->name, cookie->def->name, 8); __entry->name[7] = 0; ), - TP_printk("c=%08x p=%08x pu=%d pc=%d pf=%02x n=%s", - __entry->cookie, __entry->parent, __entry->p_usage, + TP_printk("c=%08x p=%08x pr=%d pc=%d pf=%02x n=%s", + __entry->cookie, __entry->parent, __entry->p_ref, __entry->p_n_children, __entry->p_flags, __entry->name) ); @@ -240,7 +240,7 @@ TRACE_EVENT(fscache_relinquish, TP_STRUCT__entry( __field(unsigned int, cookie ) __field(unsigned int, parent ) - __field(int, usage ) + __field(int, ref ) __field(int, n_children ) __field(int, n_active ) __field(u8, flags ) @@ -250,15 +250,15 @@ TRACE_EVENT(fscache_relinquish, TP_fast_assign( __entry->cookie = cookie->debug_id; __entry->parent = cookie->parent->debug_id; - __entry->usage = atomic_read(&cookie->usage); + __entry->ref = refcount_read(&cookie->ref); __entry->n_children = atomic_read(&cookie->n_children); __entry->n_active = atomic_read(&cookie->n_active); __entry->flags = cookie->flags; __entry->retire = retire; ), - TP_printk("c=%08x u=%d p=%08x Nc=%d Na=%d f=%02x r=%u", - __entry->cookie, __entry->usage, + TP_printk("c=%08x r=%d p=%08x Nc=%d Na=%d f=%02x r=%u", + __entry->cookie, __entry->ref, __entry->parent, __entry->n_children, __entry->n_active, __entry->flags, __entry->retire) ); @@ -270,7 +270,7 @@ TRACE_EVENT(fscache_enable, TP_STRUCT__entry( __field(unsigned int, cookie ) - __field(int, usage ) + __field(int, ref ) __field(int, n_children ) __field(int, n_active ) __field(u8, flags ) @@ -278,14 +278,14 @@ TRACE_EVENT(fscache_enable, TP_fast_assign( __entry->cookie = cookie->debug_id; - __entry->usage = atomic_read(&cookie->usage); + __entry->ref = refcount_read(&cookie->ref); __entry->n_children = atomic_read(&cookie->n_children); __entry->n_active = atomic_read(&cookie->n_active); __entry->flags = cookie->flags; ), - TP_printk("c=%08x u=%d Nc=%d Na=%d f=%02x", - __entry->cookie, __entry->usage, + TP_printk("c=%08x r=%d Nc=%d Na=%d f=%02x", + __entry->cookie, __entry->ref, __entry->n_children, __entry->n_active, __entry->flags) ); @@ -296,7 +296,7 @@ TRACE_EVENT(fscache_disable, TP_STRUCT__entry( __field(unsigned int, cookie ) - __field(int, usage ) + __field(int, ref ) __field(int, n_children ) __field(int, n_active ) __field(u8, flags ) @@ -304,14 +304,14 @@ TRACE_EVENT(fscache_disable, TP_fast_assign( __entry->cookie = cookie->debug_id; - __entry->usage = atomic_read(&cookie->usage); + __entry->ref = refcount_read(&cookie->ref); __entry->n_children = atomic_read(&cookie->n_children); __entry->n_active = atomic_read(&cookie->n_active); __entry->flags = cookie->flags; ), - TP_printk("c=%08x u=%d Nc=%d Na=%d f=%02x", - __entry->cookie, __entry->usage, + TP_printk("c=%08x r=%d Nc=%d Na=%d f=%02x", + __entry->cookie, __entry->ref, __entry->n_children, __entry->n_active, __entry->flags) ); -- cgit v1.2.3