xref: /openbmc/linux/include/trace/events/fscache.h (revision d6b6592ac6d11eab91e6758d224eac35f4122aca)
11e1236b8SDavid Howells /* SPDX-License-Identifier: GPL-2.0-or-later */
21e1236b8SDavid Howells /* FS-Cache tracepoints
31e1236b8SDavid Howells  *
41e1236b8SDavid Howells  * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
51e1236b8SDavid Howells  * Written by David Howells (dhowells@redhat.com)
61e1236b8SDavid Howells  */
71e1236b8SDavid Howells #undef TRACE_SYSTEM
81e1236b8SDavid Howells #define TRACE_SYSTEM fscache
91e1236b8SDavid Howells 
101e1236b8SDavid Howells #if !defined(_TRACE_FSCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
111e1236b8SDavid Howells #define _TRACE_FSCACHE_H
121e1236b8SDavid Howells 
131e1236b8SDavid Howells #include <linux/fscache.h>
141e1236b8SDavid Howells #include <linux/tracepoint.h>
151e1236b8SDavid Howells 
161e1236b8SDavid Howells /*
171e1236b8SDavid Howells  * Define enums for tracing information.
181e1236b8SDavid Howells  */
191e1236b8SDavid Howells #ifndef __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
201e1236b8SDavid Howells #define __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
211e1236b8SDavid Howells 
229549332dSDavid Howells enum fscache_cache_trace {
239549332dSDavid Howells 	fscache_cache_collision,
249549332dSDavid Howells 	fscache_cache_get_acquire,
259549332dSDavid Howells 	fscache_cache_new_acquire,
2662ab6335SDavid Howells 	fscache_cache_put_alloc_volume,
279549332dSDavid Howells 	fscache_cache_put_cache,
289549332dSDavid Howells 	fscache_cache_put_prep_failed,
299549332dSDavid Howells 	fscache_cache_put_relinquish,
3062ab6335SDavid Howells 	fscache_cache_put_volume,
3162ab6335SDavid Howells };
3262ab6335SDavid Howells 
3362ab6335SDavid Howells enum fscache_volume_trace {
3462ab6335SDavid Howells 	fscache_volume_collision,
3562ab6335SDavid Howells 	fscache_volume_get_cookie,
3662ab6335SDavid Howells 	fscache_volume_get_create_work,
3762ab6335SDavid Howells 	fscache_volume_get_hash_collision,
38*9dd7f566SBaokun Li 	fscache_volume_get_withdraw,
3962ab6335SDavid Howells 	fscache_volume_free,
4062ab6335SDavid Howells 	fscache_volume_new_acquire,
4162ab6335SDavid Howells 	fscache_volume_put_cookie,
4262ab6335SDavid Howells 	fscache_volume_put_create_work,
4362ab6335SDavid Howells 	fscache_volume_put_hash_collision,
4462ab6335SDavid Howells 	fscache_volume_put_relinquish,
45*9dd7f566SBaokun Li 	fscache_volume_put_withdraw,
4662ab6335SDavid Howells 	fscache_volume_see_create_work,
4762ab6335SDavid Howells 	fscache_volume_see_hash_wake,
48e6acd329SDavid Howells 	fscache_volume_wait_create_work,
499549332dSDavid Howells };
509549332dSDavid Howells 
517f3283abSDavid Howells enum fscache_cookie_trace {
527f3283abSDavid Howells 	fscache_cookie_collision,
537f3283abSDavid Howells 	fscache_cookie_discard,
541a1e3acaSJeff Layton 	fscache_cookie_failed,
55df98e87fSDavid Howells 	fscache_cookie_get_attach_object,
567f3283abSDavid Howells 	fscache_cookie_get_end_access,
577f3283abSDavid Howells 	fscache_cookie_get_hash_collision,
58d24af13eSDavid Howells 	fscache_cookie_get_inval_work,
5912bb21a2SDavid Howells 	fscache_cookie_get_lru,
6012bb21a2SDavid Howells 	fscache_cookie_get_use_work,
617f3283abSDavid Howells 	fscache_cookie_new_acquire,
627f3283abSDavid Howells 	fscache_cookie_put_hash_collision,
6312bb21a2SDavid Howells 	fscache_cookie_put_lru,
64df98e87fSDavid Howells 	fscache_cookie_put_object,
657f3283abSDavid Howells 	fscache_cookie_put_over_queued,
667f3283abSDavid Howells 	fscache_cookie_put_relinquish,
677f3283abSDavid Howells 	fscache_cookie_put_withdrawn,
687f3283abSDavid Howells 	fscache_cookie_put_work,
697f3283abSDavid Howells 	fscache_cookie_see_active,
7012bb21a2SDavid Howells 	fscache_cookie_see_lru_discard,
71b5b52de3SDave Wysochanski 	fscache_cookie_see_lru_discard_clear,
7212bb21a2SDavid Howells 	fscache_cookie_see_lru_do_one,
737f3283abSDavid Howells 	fscache_cookie_see_relinquish,
747f3283abSDavid Howells 	fscache_cookie_see_withdraw,
757f3283abSDavid Howells 	fscache_cookie_see_work,
767f3283abSDavid Howells };
777f3283abSDavid Howells 
78e6435f1eSDavid Howells enum fscache_active_trace {
79e6435f1eSDavid Howells 	fscache_active_use,
80e6435f1eSDavid Howells 	fscache_active_use_modify,
81e6435f1eSDavid Howells 	fscache_active_unuse,
82e6435f1eSDavid Howells };
83e6435f1eSDavid Howells 
8423e12e28SDavid Howells enum fscache_access_trace {
85bfa22da3SDavid Howells 	fscache_access_acquire_volume,
86bfa22da3SDavid Howells 	fscache_access_acquire_volume_end,
8723e12e28SDavid Howells 	fscache_access_cache_pin,
8823e12e28SDavid Howells 	fscache_access_cache_unpin,
89d24af13eSDavid Howells 	fscache_access_invalidate_cookie,
90d24af13eSDavid Howells 	fscache_access_invalidate_cookie_end,
91287fd611SDavid Howells 	fscache_access_io_end,
92d64f4554SDavid Howells 	fscache_access_io_not_live,
93d64f4554SDavid Howells 	fscache_access_io_read,
9416a96bdfSDavid Howells 	fscache_access_io_resize,
95d64f4554SDavid Howells 	fscache_access_io_wait,
969af1c6c3SDavid Howells 	fscache_access_io_write,
9712bb21a2SDavid Howells 	fscache_access_lookup_cookie,
985d00e426SDavid Howells 	fscache_access_lookup_cookie_end,
995d00e426SDavid Howells 	fscache_access_lookup_cookie_end_failed,
100bfa22da3SDavid Howells 	fscache_access_relinquish_volume,
101bfa22da3SDavid Howells 	fscache_access_relinquish_volume_end,
10223e12e28SDavid Howells 	fscache_access_unlive,
10323e12e28SDavid Howells };
10423e12e28SDavid Howells 
1051e1236b8SDavid Howells #endif
1061e1236b8SDavid Howells 
1071e1236b8SDavid Howells /*
1081e1236b8SDavid Howells  * Declare tracing information enums and their string mappings for display.
1091e1236b8SDavid Howells  */
1109549332dSDavid Howells #define fscache_cache_traces						\
1119549332dSDavid Howells 	EM(fscache_cache_collision,		"*COLLIDE*")		\
1129549332dSDavid Howells 	EM(fscache_cache_get_acquire,		"GET acq  ")		\
1139549332dSDavid Howells 	EM(fscache_cache_new_acquire,		"NEW acq  ")		\
11462ab6335SDavid Howells 	EM(fscache_cache_put_alloc_volume,	"PUT alvol")		\
1159549332dSDavid Howells 	EM(fscache_cache_put_cache,		"PUT cache")		\
1169549332dSDavid Howells 	EM(fscache_cache_put_prep_failed,	"PUT pfail")		\
11762ab6335SDavid Howells 	EM(fscache_cache_put_relinquish,	"PUT relnq")		\
11862ab6335SDavid Howells 	E_(fscache_cache_put_volume,		"PUT vol  ")
11962ab6335SDavid Howells 
12062ab6335SDavid Howells #define fscache_volume_traces						\
12162ab6335SDavid Howells 	EM(fscache_volume_collision,		"*COLLIDE*")		\
12262ab6335SDavid Howells 	EM(fscache_volume_get_cookie,		"GET cook ")		\
12362ab6335SDavid Howells 	EM(fscache_volume_get_create_work,	"GET creat")		\
12462ab6335SDavid Howells 	EM(fscache_volume_get_hash_collision,	"GET hcoll")		\
125*9dd7f566SBaokun Li 	EM(fscache_volume_get_withdraw,		"GET withd")            \
12662ab6335SDavid Howells 	EM(fscache_volume_free,			"FREE     ")		\
12762ab6335SDavid Howells 	EM(fscache_volume_new_acquire,		"NEW acq  ")		\
12862ab6335SDavid Howells 	EM(fscache_volume_put_cookie,		"PUT cook ")		\
12962ab6335SDavid Howells 	EM(fscache_volume_put_create_work,	"PUT creat")		\
13062ab6335SDavid Howells 	EM(fscache_volume_put_hash_collision,	"PUT hcoll")		\
13162ab6335SDavid Howells 	EM(fscache_volume_put_relinquish,	"PUT relnq")		\
132*9dd7f566SBaokun Li 	EM(fscache_volume_put_withdraw,		"PUT withd")            \
13362ab6335SDavid Howells 	EM(fscache_volume_see_create_work,	"SEE creat")		\
134bfa22da3SDavid Howells 	EM(fscache_volume_see_hash_wake,	"SEE hwake")		\
135bfa22da3SDavid Howells 	E_(fscache_volume_wait_create_work,	"WAIT crea")
1361e1236b8SDavid Howells 
1377f3283abSDavid Howells #define fscache_cookie_traces						\
1387f3283abSDavid Howells 	EM(fscache_cookie_collision,		"*COLLIDE*")		\
1397f3283abSDavid Howells 	EM(fscache_cookie_discard,		"DISCARD  ")		\
1401a1e3acaSJeff Layton 	EM(fscache_cookie_failed,		"FAILED   ")		\
141df98e87fSDavid Howells 	EM(fscache_cookie_get_attach_object,	"GET attch")		\
1427f3283abSDavid Howells 	EM(fscache_cookie_get_hash_collision,	"GET hcoll")		\
1437f3283abSDavid Howells 	EM(fscache_cookie_get_end_access,	"GQ  endac")		\
144d24af13eSDavid Howells 	EM(fscache_cookie_get_inval_work,	"GQ  inval")		\
14512bb21a2SDavid Howells 	EM(fscache_cookie_get_lru,		"GET lru  ")		\
14612bb21a2SDavid Howells 	EM(fscache_cookie_get_use_work,		"GQ  use  ")		\
1477f3283abSDavid Howells 	EM(fscache_cookie_new_acquire,		"NEW acq  ")		\
1487f3283abSDavid Howells 	EM(fscache_cookie_put_hash_collision,	"PUT hcoll")		\
14912bb21a2SDavid Howells 	EM(fscache_cookie_put_lru,		"PUT lru  ")		\
150df98e87fSDavid Howells 	EM(fscache_cookie_put_object,		"PUT obj  ")		\
1517f3283abSDavid Howells 	EM(fscache_cookie_put_over_queued,	"PQ  overq")		\
1527f3283abSDavid Howells 	EM(fscache_cookie_put_relinquish,	"PUT relnq")		\
1537f3283abSDavid Howells 	EM(fscache_cookie_put_withdrawn,	"PUT wthdn")		\
1547f3283abSDavid Howells 	EM(fscache_cookie_put_work,		"PQ  work ")		\
1557f3283abSDavid Howells 	EM(fscache_cookie_see_active,		"-   activ")		\
15612bb21a2SDavid Howells 	EM(fscache_cookie_see_lru_discard,	"-   x-lru")		\
157b5b52de3SDave Wysochanski 	EM(fscache_cookie_see_lru_discard_clear,"-   lrudc")            \
15812bb21a2SDavid Howells 	EM(fscache_cookie_see_lru_do_one,	"-   lrudo")		\
1597f3283abSDavid Howells 	EM(fscache_cookie_see_relinquish,	"-   x-rlq")		\
1607f3283abSDavid Howells 	EM(fscache_cookie_see_withdraw,		"-   x-wth")		\
1617f3283abSDavid Howells 	E_(fscache_cookie_see_work,		"-   work ")
1627f3283abSDavid Howells 
163e6435f1eSDavid Howells #define fscache_active_traces		\
164e6435f1eSDavid Howells 	EM(fscache_active_use,			"USE          ")	\
165e6435f1eSDavid Howells 	EM(fscache_active_use_modify,		"USE-m        ")	\
166e6435f1eSDavid Howells 	E_(fscache_active_unuse,		"UNUSE        ")
167e6435f1eSDavid Howells 
16823e12e28SDavid Howells #define fscache_access_traces		\
169bfa22da3SDavid Howells 	EM(fscache_access_acquire_volume,	"BEGIN acq_vol")	\
170bfa22da3SDavid Howells 	EM(fscache_access_acquire_volume_end,	"END   acq_vol")	\
17123e12e28SDavid Howells 	EM(fscache_access_cache_pin,		"PIN   cache  ")	\
17223e12e28SDavid Howells 	EM(fscache_access_cache_unpin,		"UNPIN cache  ")	\
173d24af13eSDavid Howells 	EM(fscache_access_invalidate_cookie,	"BEGIN inval  ")	\
174d24af13eSDavid Howells 	EM(fscache_access_invalidate_cookie_end,"END   inval  ")	\
175287fd611SDavid Howells 	EM(fscache_access_io_end,		"END   io     ")	\
176d64f4554SDavid Howells 	EM(fscache_access_io_not_live,		"END   io_notl")	\
177d64f4554SDavid Howells 	EM(fscache_access_io_read,		"BEGIN io_read")	\
17816a96bdfSDavid Howells 	EM(fscache_access_io_resize,		"BEGIN io_resz")	\
179d64f4554SDavid Howells 	EM(fscache_access_io_wait,		"WAIT  io     ")	\
1809af1c6c3SDavid Howells 	EM(fscache_access_io_write,		"BEGIN io_writ")	\
18112bb21a2SDavid Howells 	EM(fscache_access_lookup_cookie,	"BEGIN lookup ")	\
1825d00e426SDavid Howells 	EM(fscache_access_lookup_cookie_end,	"END   lookup ")	\
1835d00e426SDavid Howells 	EM(fscache_access_lookup_cookie_end_failed,"END   lookupf")	\
184bfa22da3SDavid Howells 	EM(fscache_access_relinquish_volume,	"BEGIN rlq_vol")	\
185bfa22da3SDavid Howells 	EM(fscache_access_relinquish_volume_end,"END   rlq_vol")	\
18623e12e28SDavid Howells 	E_(fscache_access_unlive,		"END   unlive ")
18723e12e28SDavid Howells 
1881e1236b8SDavid Howells /*
1891e1236b8SDavid Howells  * Export enum symbols via userspace.
1901e1236b8SDavid Howells  */
1911e1236b8SDavid Howells #undef EM
1921e1236b8SDavid Howells #undef E_
1931e1236b8SDavid Howells #define EM(a, b) TRACE_DEFINE_ENUM(a);
1941e1236b8SDavid Howells #define E_(a, b) TRACE_DEFINE_ENUM(a);
1951e1236b8SDavid Howells 
1969549332dSDavid Howells fscache_cache_traces;
19762ab6335SDavid Howells fscache_volume_traces;
1987f3283abSDavid Howells fscache_cookie_traces;
19923e12e28SDavid Howells fscache_access_traces;
2009549332dSDavid Howells 
2011e1236b8SDavid Howells /*
2021e1236b8SDavid Howells  * Now redefine the EM() and E_() macros to map the enums to the strings that
2031e1236b8SDavid Howells  * will be printed in the output.
2041e1236b8SDavid Howells  */
2051e1236b8SDavid Howells #undef EM
2061e1236b8SDavid Howells #undef E_
2071e1236b8SDavid Howells #define EM(a, b)	{ a, b },
2081e1236b8SDavid Howells #define E_(a, b)	{ a, b }
2091e1236b8SDavid Howells 
2101e1236b8SDavid Howells 
2119549332dSDavid Howells TRACE_EVENT(fscache_cache,
2129549332dSDavid Howells 	    TP_PROTO(unsigned int cache_debug_id,
2139549332dSDavid Howells 		     int usage,
2149549332dSDavid Howells 		     enum fscache_cache_trace where),
2159549332dSDavid Howells 
2169549332dSDavid Howells 	    TP_ARGS(cache_debug_id, usage, where),
2179549332dSDavid Howells 
2189549332dSDavid Howells 	    TP_STRUCT__entry(
2199549332dSDavid Howells 		    __field(unsigned int,		cache		)
2209549332dSDavid Howells 		    __field(int,			usage		)
2219549332dSDavid Howells 		    __field(enum fscache_cache_trace,	where		)
2229549332dSDavid Howells 			     ),
2239549332dSDavid Howells 
2249549332dSDavid Howells 	    TP_fast_assign(
2259549332dSDavid Howells 		    __entry->cache	= cache_debug_id;
2269549332dSDavid Howells 		    __entry->usage	= usage;
2279549332dSDavid Howells 		    __entry->where	= where;
2289549332dSDavid Howells 			   ),
2299549332dSDavid Howells 
2309549332dSDavid Howells 	    TP_printk("C=%08x %s r=%d",
2319549332dSDavid Howells 		      __entry->cache,
2329549332dSDavid Howells 		      __print_symbolic(__entry->where, fscache_cache_traces),
2339549332dSDavid Howells 		      __entry->usage)
2349549332dSDavid Howells 	    );
2359549332dSDavid Howells 
23662ab6335SDavid Howells TRACE_EVENT(fscache_volume,
23762ab6335SDavid Howells 	    TP_PROTO(unsigned int volume_debug_id,
23862ab6335SDavid Howells 		     int usage,
23962ab6335SDavid Howells 		     enum fscache_volume_trace where),
24062ab6335SDavid Howells 
24162ab6335SDavid Howells 	    TP_ARGS(volume_debug_id, usage, where),
24262ab6335SDavid Howells 
24362ab6335SDavid Howells 	    TP_STRUCT__entry(
24462ab6335SDavid Howells 		    __field(unsigned int,		volume		)
24562ab6335SDavid Howells 		    __field(int,			usage		)
24662ab6335SDavid Howells 		    __field(enum fscache_volume_trace,	where		)
24762ab6335SDavid Howells 			     ),
24862ab6335SDavid Howells 
24962ab6335SDavid Howells 	    TP_fast_assign(
25062ab6335SDavid Howells 		    __entry->volume	= volume_debug_id;
25162ab6335SDavid Howells 		    __entry->usage	= usage;
25262ab6335SDavid Howells 		    __entry->where	= where;
25362ab6335SDavid Howells 			   ),
25462ab6335SDavid Howells 
25562ab6335SDavid Howells 	    TP_printk("V=%08x %s u=%d",
25662ab6335SDavid Howells 		      __entry->volume,
25762ab6335SDavid Howells 		      __print_symbolic(__entry->where, fscache_volume_traces),
25862ab6335SDavid Howells 		      __entry->usage)
25962ab6335SDavid Howells 	    );
26062ab6335SDavid Howells 
2617f3283abSDavid Howells TRACE_EVENT(fscache_cookie,
2627f3283abSDavid Howells 	    TP_PROTO(unsigned int cookie_debug_id,
2637f3283abSDavid Howells 		     int ref,
2647f3283abSDavid Howells 		     enum fscache_cookie_trace where),
2657f3283abSDavid Howells 
2667f3283abSDavid Howells 	    TP_ARGS(cookie_debug_id, ref, where),
2677f3283abSDavid Howells 
2687f3283abSDavid Howells 	    TP_STRUCT__entry(
2697f3283abSDavid Howells 		    __field(unsigned int,		cookie		)
2707f3283abSDavid Howells 		    __field(int,			ref		)
2717f3283abSDavid Howells 		    __field(enum fscache_cookie_trace,	where		)
2727f3283abSDavid Howells 			     ),
2737f3283abSDavid Howells 
2747f3283abSDavid Howells 	    TP_fast_assign(
2757f3283abSDavid Howells 		    __entry->cookie	= cookie_debug_id;
2767f3283abSDavid Howells 		    __entry->ref	= ref;
2777f3283abSDavid Howells 		    __entry->where	= where;
2787f3283abSDavid Howells 			   ),
2797f3283abSDavid Howells 
2807f3283abSDavid Howells 	    TP_printk("c=%08x %s r=%d",
2817f3283abSDavid Howells 		      __entry->cookie,
2827f3283abSDavid Howells 		      __print_symbolic(__entry->where, fscache_cookie_traces),
2837f3283abSDavid Howells 		      __entry->ref)
2847f3283abSDavid Howells 	    );
2857f3283abSDavid Howells 
286e6435f1eSDavid Howells TRACE_EVENT(fscache_active,
287e6435f1eSDavid Howells 	    TP_PROTO(unsigned int cookie_debug_id,
288e6435f1eSDavid Howells 		     int ref,
289e6435f1eSDavid Howells 		     int n_active,
290e6435f1eSDavid Howells 		     int n_accesses,
291e6435f1eSDavid Howells 		     enum fscache_active_trace why),
292e6435f1eSDavid Howells 
293e6435f1eSDavid Howells 	    TP_ARGS(cookie_debug_id, ref, n_active, n_accesses, why),
294e6435f1eSDavid Howells 
295e6435f1eSDavid Howells 	    TP_STRUCT__entry(
296e6435f1eSDavid Howells 		    __field(unsigned int,		cookie		)
297e6435f1eSDavid Howells 		    __field(int,			ref		)
298e6435f1eSDavid Howells 		    __field(int,			n_active	)
299e6435f1eSDavid Howells 		    __field(int,			n_accesses	)
300e6435f1eSDavid Howells 		    __field(enum fscache_active_trace,	why		)
301e6435f1eSDavid Howells 			     ),
302e6435f1eSDavid Howells 
303e6435f1eSDavid Howells 	    TP_fast_assign(
304e6435f1eSDavid Howells 		    __entry->cookie	= cookie_debug_id;
305e6435f1eSDavid Howells 		    __entry->ref	= ref;
306e6435f1eSDavid Howells 		    __entry->n_active	= n_active;
307e6435f1eSDavid Howells 		    __entry->n_accesses	= n_accesses;
308e6435f1eSDavid Howells 		    __entry->why	= why;
309e6435f1eSDavid Howells 			   ),
310e6435f1eSDavid Howells 
311e6435f1eSDavid Howells 	    TP_printk("c=%08x %s r=%d a=%d c=%d",
312e6435f1eSDavid Howells 		      __entry->cookie,
313e6435f1eSDavid Howells 		      __print_symbolic(__entry->why, fscache_active_traces),
314e6435f1eSDavid Howells 		      __entry->ref,
315e6435f1eSDavid Howells 		      __entry->n_accesses,
316e6435f1eSDavid Howells 		      __entry->n_active)
317e6435f1eSDavid Howells 	    );
318e6435f1eSDavid Howells 
31923e12e28SDavid Howells TRACE_EVENT(fscache_access_cache,
32023e12e28SDavid Howells 	    TP_PROTO(unsigned int cache_debug_id,
32123e12e28SDavid Howells 		     int ref,
32223e12e28SDavid Howells 		     int n_accesses,
32323e12e28SDavid Howells 		     enum fscache_access_trace why),
32423e12e28SDavid Howells 
32523e12e28SDavid Howells 	    TP_ARGS(cache_debug_id, ref, n_accesses, why),
32623e12e28SDavid Howells 
32723e12e28SDavid Howells 	    TP_STRUCT__entry(
32823e12e28SDavid Howells 		    __field(unsigned int,		cache		)
32923e12e28SDavid Howells 		    __field(int,			ref		)
33023e12e28SDavid Howells 		    __field(int,			n_accesses	)
33123e12e28SDavid Howells 		    __field(enum fscache_access_trace,	why		)
33223e12e28SDavid Howells 			     ),
33323e12e28SDavid Howells 
33423e12e28SDavid Howells 	    TP_fast_assign(
33523e12e28SDavid Howells 		    __entry->cache	= cache_debug_id;
33623e12e28SDavid Howells 		    __entry->ref	= ref;
33723e12e28SDavid Howells 		    __entry->n_accesses	= n_accesses;
33823e12e28SDavid Howells 		    __entry->why	= why;
33923e12e28SDavid Howells 			   ),
34023e12e28SDavid Howells 
34123e12e28SDavid Howells 	    TP_printk("C=%08x %s r=%d a=%d",
34223e12e28SDavid Howells 		      __entry->cache,
34323e12e28SDavid Howells 		      __print_symbolic(__entry->why, fscache_access_traces),
34423e12e28SDavid Howells 		      __entry->ref,
34523e12e28SDavid Howells 		      __entry->n_accesses)
34623e12e28SDavid Howells 	    );
34723e12e28SDavid Howells 
348e6acd329SDavid Howells TRACE_EVENT(fscache_access_volume,
349e6acd329SDavid Howells 	    TP_PROTO(unsigned int volume_debug_id,
350e6acd329SDavid Howells 		     unsigned int cookie_debug_id,
351e6acd329SDavid Howells 		     int ref,
352e6acd329SDavid Howells 		     int n_accesses,
353e6acd329SDavid Howells 		     enum fscache_access_trace why),
354e6acd329SDavid Howells 
355e6acd329SDavid Howells 	    TP_ARGS(volume_debug_id, cookie_debug_id, ref, n_accesses, why),
356e6acd329SDavid Howells 
357e6acd329SDavid Howells 	    TP_STRUCT__entry(
358e6acd329SDavid Howells 		    __field(unsigned int,		volume		)
359e6acd329SDavid Howells 		    __field(unsigned int,		cookie		)
360e6acd329SDavid Howells 		    __field(int,			ref		)
361e6acd329SDavid Howells 		    __field(int,			n_accesses	)
362e6acd329SDavid Howells 		    __field(enum fscache_access_trace,	why		)
363e6acd329SDavid Howells 			     ),
364e6acd329SDavid Howells 
365e6acd329SDavid Howells 	    TP_fast_assign(
366e6acd329SDavid Howells 		    __entry->volume	= volume_debug_id;
367e6acd329SDavid Howells 		    __entry->cookie	= cookie_debug_id;
368e6acd329SDavid Howells 		    __entry->ref	= ref;
369e6acd329SDavid Howells 		    __entry->n_accesses	= n_accesses;
370e6acd329SDavid Howells 		    __entry->why	= why;
371e6acd329SDavid Howells 			   ),
372e6acd329SDavid Howells 
373e6acd329SDavid Howells 	    TP_printk("V=%08x c=%08x %s r=%d a=%d",
374e6acd329SDavid Howells 		      __entry->volume,
375e6acd329SDavid Howells 		      __entry->cookie,
376e6acd329SDavid Howells 		      __print_symbolic(__entry->why, fscache_access_traces),
377e6acd329SDavid Howells 		      __entry->ref,
378e6acd329SDavid Howells 		      __entry->n_accesses)
379e6acd329SDavid Howells 	    );
380e6acd329SDavid Howells 
381a7733fb6SDavid Howells TRACE_EVENT(fscache_access,
382a7733fb6SDavid Howells 	    TP_PROTO(unsigned int cookie_debug_id,
383a7733fb6SDavid Howells 		     int ref,
384a7733fb6SDavid Howells 		     int n_accesses,
385a7733fb6SDavid Howells 		     enum fscache_access_trace why),
386a7733fb6SDavid Howells 
387a7733fb6SDavid Howells 	    TP_ARGS(cookie_debug_id, ref, n_accesses, why),
388a7733fb6SDavid Howells 
389a7733fb6SDavid Howells 	    TP_STRUCT__entry(
390a7733fb6SDavid Howells 		    __field(unsigned int,		cookie		)
391a7733fb6SDavid Howells 		    __field(int,			ref		)
392a7733fb6SDavid Howells 		    __field(int,			n_accesses	)
393a7733fb6SDavid Howells 		    __field(enum fscache_access_trace,	why		)
394a7733fb6SDavid Howells 			     ),
395a7733fb6SDavid Howells 
396a7733fb6SDavid Howells 	    TP_fast_assign(
397a7733fb6SDavid Howells 		    __entry->cookie	= cookie_debug_id;
398a7733fb6SDavid Howells 		    __entry->ref	= ref;
399a7733fb6SDavid Howells 		    __entry->n_accesses	= n_accesses;
400a7733fb6SDavid Howells 		    __entry->why	= why;
401a7733fb6SDavid Howells 			   ),
402a7733fb6SDavid Howells 
403a7733fb6SDavid Howells 	    TP_printk("c=%08x %s r=%d a=%d",
404a7733fb6SDavid Howells 		      __entry->cookie,
405a7733fb6SDavid Howells 		      __print_symbolic(__entry->why, fscache_access_traces),
406a7733fb6SDavid Howells 		      __entry->ref,
407a7733fb6SDavid Howells 		      __entry->n_accesses)
408a7733fb6SDavid Howells 	    );
409a7733fb6SDavid Howells 
4107f3283abSDavid Howells TRACE_EVENT(fscache_acquire,
4117f3283abSDavid Howells 	    TP_PROTO(struct fscache_cookie *cookie),
4127f3283abSDavid Howells 
4137f3283abSDavid Howells 	    TP_ARGS(cookie),
4147f3283abSDavid Howells 
4157f3283abSDavid Howells 	    TP_STRUCT__entry(
4167f3283abSDavid Howells 		    __field(unsigned int,		cookie		)
4177f3283abSDavid Howells 		    __field(unsigned int,		volume		)
4187f3283abSDavid Howells 		    __field(int,			v_ref		)
4197f3283abSDavid Howells 		    __field(int,			v_n_cookies	)
4207f3283abSDavid Howells 			     ),
4217f3283abSDavid Howells 
4227f3283abSDavid Howells 	    TP_fast_assign(
4237f3283abSDavid Howells 		    __entry->cookie		= cookie->debug_id;
4247f3283abSDavid Howells 		    __entry->volume		= cookie->volume->debug_id;
4257f3283abSDavid Howells 		    __entry->v_ref		= refcount_read(&cookie->volume->ref);
4267f3283abSDavid Howells 		    __entry->v_n_cookies	= atomic_read(&cookie->volume->n_cookies);
4277f3283abSDavid Howells 			   ),
4287f3283abSDavid Howells 
4297f3283abSDavid Howells 	    TP_printk("c=%08x V=%08x vr=%d vc=%d",
4307f3283abSDavid Howells 		      __entry->cookie,
4317f3283abSDavid Howells 		      __entry->volume, __entry->v_ref, __entry->v_n_cookies)
4327f3283abSDavid Howells 	    );
4337f3283abSDavid Howells 
4347f3283abSDavid Howells TRACE_EVENT(fscache_relinquish,
4357f3283abSDavid Howells 	    TP_PROTO(struct fscache_cookie *cookie, bool retire),
4367f3283abSDavid Howells 
4377f3283abSDavid Howells 	    TP_ARGS(cookie, retire),
4387f3283abSDavid Howells 
4397f3283abSDavid Howells 	    TP_STRUCT__entry(
4407f3283abSDavid Howells 		    __field(unsigned int,		cookie		)
4417f3283abSDavid Howells 		    __field(unsigned int,		volume		)
4427f3283abSDavid Howells 		    __field(int,			ref		)
4437f3283abSDavid Howells 		    __field(int,			n_active	)
4447f3283abSDavid Howells 		    __field(u8,				flags		)
4457f3283abSDavid Howells 		    __field(bool,			retire		)
4467f3283abSDavid Howells 			     ),
4477f3283abSDavid Howells 
4487f3283abSDavid Howells 	    TP_fast_assign(
4497f3283abSDavid Howells 		    __entry->cookie	= cookie->debug_id;
4507f3283abSDavid Howells 		    __entry->volume	= cookie->volume->debug_id;
4517f3283abSDavid Howells 		    __entry->ref	= refcount_read(&cookie->ref);
4527f3283abSDavid Howells 		    __entry->n_active	= atomic_read(&cookie->n_active);
4537f3283abSDavid Howells 		    __entry->flags	= cookie->flags;
4547f3283abSDavid Howells 		    __entry->retire	= retire;
4557f3283abSDavid Howells 			   ),
4567f3283abSDavid Howells 
4577f3283abSDavid Howells 	    TP_printk("c=%08x V=%08x r=%d U=%d f=%02x rt=%u",
4587f3283abSDavid Howells 		      __entry->cookie, __entry->volume, __entry->ref,
4597f3283abSDavid Howells 		      __entry->n_active, __entry->flags, __entry->retire)
4607f3283abSDavid Howells 	    );
4617f3283abSDavid Howells 
462d24af13eSDavid Howells TRACE_EVENT(fscache_invalidate,
463d24af13eSDavid Howells 	    TP_PROTO(struct fscache_cookie *cookie, loff_t new_size),
464d24af13eSDavid Howells 
465d24af13eSDavid Howells 	    TP_ARGS(cookie, new_size),
466d24af13eSDavid Howells 
467d24af13eSDavid Howells 	    TP_STRUCT__entry(
468d24af13eSDavid Howells 		    __field(unsigned int,		cookie		)
469d24af13eSDavid Howells 		    __field(loff_t,			new_size	)
470d24af13eSDavid Howells 			     ),
471d24af13eSDavid Howells 
472d24af13eSDavid Howells 	    TP_fast_assign(
473d24af13eSDavid Howells 		    __entry->cookie	= cookie->debug_id;
474d24af13eSDavid Howells 		    __entry->new_size	= new_size;
475d24af13eSDavid Howells 			   ),
476d24af13eSDavid Howells 
477d24af13eSDavid Howells 	    TP_printk("c=%08x sz=%llx",
478d24af13eSDavid Howells 		      __entry->cookie, __entry->new_size)
479d24af13eSDavid Howells 	    );
480d24af13eSDavid Howells 
48116a96bdfSDavid Howells TRACE_EVENT(fscache_resize,
48216a96bdfSDavid Howells 	    TP_PROTO(struct fscache_cookie *cookie, loff_t new_size),
48316a96bdfSDavid Howells 
48416a96bdfSDavid Howells 	    TP_ARGS(cookie, new_size),
48516a96bdfSDavid Howells 
48616a96bdfSDavid Howells 	    TP_STRUCT__entry(
48716a96bdfSDavid Howells 		    __field(unsigned int,		cookie		)
48816a96bdfSDavid Howells 		    __field(loff_t,			old_size	)
48916a96bdfSDavid Howells 		    __field(loff_t,			new_size	)
49016a96bdfSDavid Howells 			     ),
49116a96bdfSDavid Howells 
49216a96bdfSDavid Howells 	    TP_fast_assign(
49316a96bdfSDavid Howells 		    __entry->cookie	= cookie->debug_id;
49416a96bdfSDavid Howells 		    __entry->old_size	= cookie->object_size;
49516a96bdfSDavid Howells 		    __entry->new_size	= new_size;
49616a96bdfSDavid Howells 			   ),
49716a96bdfSDavid Howells 
49816a96bdfSDavid Howells 	    TP_printk("c=%08x os=%08llx sz=%08llx",
49916a96bdfSDavid Howells 		      __entry->cookie,
50016a96bdfSDavid Howells 		      __entry->old_size,
50116a96bdfSDavid Howells 		      __entry->new_size)
50216a96bdfSDavid Howells 	    );
50316a96bdfSDavid Howells 
5041e1236b8SDavid Howells #endif /* _TRACE_FSCACHE_H */
5051e1236b8SDavid Howells 
5061e1236b8SDavid Howells /* This part must be outside protection */
5071e1236b8SDavid Howells #include <trace/define_trace.h>
508