Linux Audio

Check our new training course

Loading...
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/* CacheFiles tracepoints
  3 *
  4 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  5 * Written by David Howells (dhowells@redhat.com)
 
 
 
 
 
  6 */
  7#undef TRACE_SYSTEM
  8#define TRACE_SYSTEM cachefiles
  9
 10#if !defined(_TRACE_CACHEFILES_H) || defined(TRACE_HEADER_MULTI_READ)
 11#define _TRACE_CACHEFILES_H
 12
 13#include <linux/tracepoint.h>
 14
 15/*
 16 * Define enums for tracing information.
 17 */
 18#ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
 19#define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
 20
 21enum cachefiles_obj_ref_trace {
 22	cachefiles_obj_put_wait_retry = fscache_obj_ref__nr_traces,
 23	cachefiles_obj_put_wait_timeo,
 24	cachefiles_obj_ref__nr_traces
 25};
 26
 27#endif
 28
 29/*
 30 * Define enum -> string mappings for display.
 31 */
 32#define cachefiles_obj_kill_traces				\
 33	EM(FSCACHE_OBJECT_IS_STALE,	"stale")		\
 34	EM(FSCACHE_OBJECT_NO_SPACE,	"no_space")		\
 35	EM(FSCACHE_OBJECT_WAS_RETIRED,	"was_retired")		\
 36	E_(FSCACHE_OBJECT_WAS_CULLED,	"was_culled")
 37
 38#define cachefiles_obj_ref_traces					\
 39	EM(fscache_obj_get_add_to_deps,		"GET add_to_deps")	\
 40	EM(fscache_obj_get_queue,		"GET queue")		\
 41	EM(fscache_obj_put_alloc_fail,		"PUT alloc_fail")	\
 42	EM(fscache_obj_put_attach_fail,		"PUT attach_fail")	\
 43	EM(fscache_obj_put_drop_obj,		"PUT drop_obj")		\
 44	EM(fscache_obj_put_enq_dep,		"PUT enq_dep")		\
 45	EM(fscache_obj_put_queue,		"PUT queue")		\
 46	EM(fscache_obj_put_work,		"PUT work")		\
 47	EM(cachefiles_obj_put_wait_retry,	"PUT wait_retry")	\
 48	E_(cachefiles_obj_put_wait_timeo,	"PUT wait_timeo")
 49
 50/*
 51 * Export enum symbols via userspace.
 52 */
 53#undef EM
 54#undef E_
 55#define EM(a, b) TRACE_DEFINE_ENUM(a);
 56#define E_(a, b) TRACE_DEFINE_ENUM(a);
 57
 58cachefiles_obj_kill_traces;
 59cachefiles_obj_ref_traces;
 60
 61/*
 62 * Now redefine the EM() and E_() macros to map the enums to the strings that
 63 * will be printed in the output.
 64 */
 65#undef EM
 66#undef E_
 67#define EM(a, b)	{ a, b },
 68#define E_(a, b)	{ a, b }
 69
 70
 71TRACE_EVENT(cachefiles_ref,
 72	    TP_PROTO(struct cachefiles_object *obj,
 73		     struct fscache_cookie *cookie,
 74		     enum cachefiles_obj_ref_trace why,
 75		     int usage),
 76
 77	    TP_ARGS(obj, cookie, why, usage),
 78
 79	    /* Note that obj may be NULL */
 80	    TP_STRUCT__entry(
 81		    __field(struct cachefiles_object *,		obj		)
 82		    __field(struct fscache_cookie *,		cookie		)
 83		    __field(enum cachefiles_obj_ref_trace,	why		)
 84		    __field(int,				usage		)
 85			     ),
 86
 87	    TP_fast_assign(
 88		    __entry->obj	= obj;
 89		    __entry->cookie	= cookie;
 90		    __entry->usage	= usage;
 91		    __entry->why	= why;
 92			   ),
 93
 94	    TP_printk("c=%p o=%p u=%d %s",
 95		      __entry->cookie, __entry->obj, __entry->usage,
 96		      __print_symbolic(__entry->why, cachefiles_obj_ref_traces))
 97	    );
 98
 99TRACE_EVENT(cachefiles_lookup,
100	    TP_PROTO(struct cachefiles_object *obj,
101		     struct dentry *de,
102		     struct inode *inode),
103
104	    TP_ARGS(obj, de, inode),
105
106	    TP_STRUCT__entry(
107		    __field(struct cachefiles_object *,	obj	)
108		    __field(struct dentry *,		de	)
109		    __field(struct inode *,		inode	)
110			     ),
111
112	    TP_fast_assign(
113		    __entry->obj	= obj;
114		    __entry->de		= de;
115		    __entry->inode	= inode;
116			   ),
117
118	    TP_printk("o=%p d=%p i=%p",
119		      __entry->obj, __entry->de, __entry->inode)
120	    );
121
122TRACE_EVENT(cachefiles_mkdir,
123	    TP_PROTO(struct cachefiles_object *obj,
124		     struct dentry *de, int ret),
125
126	    TP_ARGS(obj, de, ret),
127
128	    TP_STRUCT__entry(
129		    __field(struct cachefiles_object *,	obj	)
130		    __field(struct dentry *,		de	)
131		    __field(int,			ret	)
132			     ),
133
134	    TP_fast_assign(
135		    __entry->obj	= obj;
136		    __entry->de		= de;
137		    __entry->ret	= ret;
138			   ),
139
140	    TP_printk("o=%p d=%p r=%u",
141		      __entry->obj, __entry->de, __entry->ret)
142	    );
143
144TRACE_EVENT(cachefiles_create,
145	    TP_PROTO(struct cachefiles_object *obj,
146		     struct dentry *de, int ret),
147
148	    TP_ARGS(obj, de, ret),
149
150	    TP_STRUCT__entry(
151		    __field(struct cachefiles_object *,	obj	)
152		    __field(struct dentry *,		de	)
153		    __field(int,			ret	)
154			     ),
155
156	    TP_fast_assign(
157		    __entry->obj	= obj;
158		    __entry->de		= de;
159		    __entry->ret	= ret;
160			   ),
161
162	    TP_printk("o=%p d=%p r=%u",
163		      __entry->obj, __entry->de, __entry->ret)
164	    );
165
166TRACE_EVENT(cachefiles_unlink,
167	    TP_PROTO(struct cachefiles_object *obj,
168		     struct dentry *de,
169		     enum fscache_why_object_killed why),
170
171	    TP_ARGS(obj, de, why),
172
173	    /* Note that obj may be NULL */
174	    TP_STRUCT__entry(
175		    __field(struct cachefiles_object *,	obj		)
176		    __field(struct dentry *,		de		)
177		    __field(enum fscache_why_object_killed, why		)
178			     ),
179
180	    TP_fast_assign(
181		    __entry->obj	= obj;
182		    __entry->de		= de;
183		    __entry->why	= why;
184			   ),
185
186	    TP_printk("o=%p d=%p w=%s",
187		      __entry->obj, __entry->de,
188		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
189	    );
190
191TRACE_EVENT(cachefiles_rename,
192	    TP_PROTO(struct cachefiles_object *obj,
193		     struct dentry *de,
194		     struct dentry *to,
195		     enum fscache_why_object_killed why),
196
197	    TP_ARGS(obj, de, to, why),
198
199	    /* Note that obj may be NULL */
200	    TP_STRUCT__entry(
201		    __field(struct cachefiles_object *,	obj		)
202		    __field(struct dentry *,		de		)
203		    __field(struct dentry *,		to		)
204		    __field(enum fscache_why_object_killed, why		)
205			     ),
206
207	    TP_fast_assign(
208		    __entry->obj	= obj;
209		    __entry->de		= de;
210		    __entry->to		= to;
211		    __entry->why	= why;
212			   ),
213
214	    TP_printk("o=%p d=%p t=%p w=%s",
215		      __entry->obj, __entry->de, __entry->to,
216		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
217	    );
218
219TRACE_EVENT(cachefiles_mark_active,
220	    TP_PROTO(struct cachefiles_object *obj,
221		     struct dentry *de),
222
223	    TP_ARGS(obj, de),
224
225	    /* Note that obj may be NULL */
226	    TP_STRUCT__entry(
227		    __field(struct cachefiles_object *,	obj		)
228		    __field(struct dentry *,		de		)
229			     ),
230
231	    TP_fast_assign(
232		    __entry->obj	= obj;
233		    __entry->de		= de;
234			   ),
235
236	    TP_printk("o=%p d=%p",
237		      __entry->obj, __entry->de)
238	    );
239
240TRACE_EVENT(cachefiles_wait_active,
241	    TP_PROTO(struct cachefiles_object *obj,
242		     struct dentry *de,
243		     struct cachefiles_object *xobj),
244
245	    TP_ARGS(obj, de, xobj),
246
247	    /* Note that obj may be NULL */
248	    TP_STRUCT__entry(
249		    __field(struct cachefiles_object *,	obj		)
250		    __field(struct dentry *,		de		)
251		    __field(struct cachefiles_object *,	xobj		)
252		    __field(u16,			flags		)
253		    __field(u16,			fsc_flags	)
254			     ),
255
256	    TP_fast_assign(
257		    __entry->obj	= obj;
258		    __entry->de		= de;
259		    __entry->xobj	= xobj;
260		    __entry->flags	= xobj->flags;
261		    __entry->fsc_flags	= xobj->fscache.flags;
262			   ),
263
264	    TP_printk("o=%p d=%p wo=%p wf=%x wff=%x",
265		      __entry->obj, __entry->de, __entry->xobj,
266		      __entry->flags, __entry->fsc_flags)
267	    );
268
269TRACE_EVENT(cachefiles_mark_inactive,
270	    TP_PROTO(struct cachefiles_object *obj,
271		     struct dentry *de,
272		     struct inode *inode),
273
274	    TP_ARGS(obj, de, inode),
275
276	    /* Note that obj may be NULL */
277	    TP_STRUCT__entry(
278		    __field(struct cachefiles_object *,	obj		)
279		    __field(struct dentry *,		de		)
280		    __field(struct inode *,		inode		)
281			     ),
282
283	    TP_fast_assign(
284		    __entry->obj	= obj;
285		    __entry->de		= de;
286		    __entry->inode	= inode;
287			   ),
288
289	    TP_printk("o=%p d=%p i=%p",
290		      __entry->obj, __entry->de, __entry->inode)
291	    );
292
293TRACE_EVENT(cachefiles_mark_buried,
294	    TP_PROTO(struct cachefiles_object *obj,
295		     struct dentry *de,
296		     enum fscache_why_object_killed why),
297
298	    TP_ARGS(obj, de, why),
299
300	    /* Note that obj may be NULL */
301	    TP_STRUCT__entry(
302		    __field(struct cachefiles_object *,	obj		)
303		    __field(struct dentry *,		de		)
304		    __field(enum fscache_why_object_killed, why		)
305			     ),
306
307	    TP_fast_assign(
308		    __entry->obj	= obj;
309		    __entry->de		= de;
310		    __entry->why	= why;
311			   ),
312
313	    TP_printk("o=%p d=%p w=%s",
314		      __entry->obj, __entry->de,
315		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
316	    );
317
318#endif /* _TRACE_CACHEFILES_H */
319
320/* This part must be outside protection */
321#include <trace/define_trace.h>
v4.17
 
  1/* CacheFiles tracepoints
  2 *
  3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
  4 * Written by David Howells (dhowells@redhat.com)
  5 *
  6 * This program is free software; you can redistribute it and/or
  7 * modify it under the terms of the GNU General Public Licence
  8 * as published by the Free Software Foundation; either version
  9 * 2 of the Licence, or (at your option) any later version.
 10 */
 11#undef TRACE_SYSTEM
 12#define TRACE_SYSTEM cachefiles
 13
 14#if !defined(_TRACE_CACHEFILES_H) || defined(TRACE_HEADER_MULTI_READ)
 15#define _TRACE_CACHEFILES_H
 16
 17#include <linux/tracepoint.h>
 18
 19/*
 20 * Define enums for tracing information.
 21 */
 22#ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
 23#define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
 24
 25enum cachefiles_obj_ref_trace {
 26	cachefiles_obj_put_wait_retry = fscache_obj_ref__nr_traces,
 27	cachefiles_obj_put_wait_timeo,
 28	cachefiles_obj_ref__nr_traces
 29};
 30
 31#endif
 32
 33/*
 34 * Define enum -> string mappings for display.
 35 */
 36#define cachefiles_obj_kill_traces				\
 37	EM(FSCACHE_OBJECT_IS_STALE,	"stale")		\
 38	EM(FSCACHE_OBJECT_NO_SPACE,	"no_space")		\
 39	EM(FSCACHE_OBJECT_WAS_RETIRED,	"was_retired")		\
 40	E_(FSCACHE_OBJECT_WAS_CULLED,	"was_culled")
 41
 42#define cachefiles_obj_ref_traces					\
 43	EM(fscache_obj_get_add_to_deps,		"GET add_to_deps")	\
 44	EM(fscache_obj_get_queue,		"GET queue")		\
 45	EM(fscache_obj_put_alloc_fail,		"PUT alloc_fail")	\
 46	EM(fscache_obj_put_attach_fail,		"PUT attach_fail")	\
 47	EM(fscache_obj_put_drop_obj,		"PUT drop_obj")		\
 48	EM(fscache_obj_put_enq_dep,		"PUT enq_dep")		\
 49	EM(fscache_obj_put_queue,		"PUT queue")		\
 50	EM(fscache_obj_put_work,		"PUT work")		\
 51	EM(cachefiles_obj_put_wait_retry,	"PUT wait_retry")	\
 52	E_(cachefiles_obj_put_wait_timeo,	"PUT wait_timeo")
 53
 54/*
 55 * Export enum symbols via userspace.
 56 */
 57#undef EM
 58#undef E_
 59#define EM(a, b) TRACE_DEFINE_ENUM(a);
 60#define E_(a, b) TRACE_DEFINE_ENUM(a);
 61
 62cachefiles_obj_kill_traces;
 63cachefiles_obj_ref_traces;
 64
 65/*
 66 * Now redefine the EM() and E_() macros to map the enums to the strings that
 67 * will be printed in the output.
 68 */
 69#undef EM
 70#undef E_
 71#define EM(a, b)	{ a, b },
 72#define E_(a, b)	{ a, b }
 73
 74
 75TRACE_EVENT(cachefiles_ref,
 76	    TP_PROTO(struct cachefiles_object *obj,
 77		     struct fscache_cookie *cookie,
 78		     enum cachefiles_obj_ref_trace why,
 79		     int usage),
 80
 81	    TP_ARGS(obj, cookie, why, usage),
 82
 83	    /* Note that obj may be NULL */
 84	    TP_STRUCT__entry(
 85		    __field(struct cachefiles_object *,		obj		)
 86		    __field(struct fscache_cookie *,		cookie		)
 87		    __field(enum cachefiles_obj_ref_trace,	why		)
 88		    __field(int,				usage		)
 89			     ),
 90
 91	    TP_fast_assign(
 92		    __entry->obj	= obj;
 93		    __entry->cookie	= cookie;
 94		    __entry->usage	= usage;
 95		    __entry->why	= why;
 96			   ),
 97
 98	    TP_printk("c=%p o=%p u=%d %s",
 99		      __entry->cookie, __entry->obj, __entry->usage,
100		      __print_symbolic(__entry->why, cachefiles_obj_ref_traces))
101	    );
102
103TRACE_EVENT(cachefiles_lookup,
104	    TP_PROTO(struct cachefiles_object *obj,
105		     struct dentry *de,
106		     struct inode *inode),
107
108	    TP_ARGS(obj, de, inode),
109
110	    TP_STRUCT__entry(
111		    __field(struct cachefiles_object *,	obj	)
112		    __field(struct dentry *,		de	)
113		    __field(struct inode *,		inode	)
114			     ),
115
116	    TP_fast_assign(
117		    __entry->obj	= obj;
118		    __entry->de		= de;
119		    __entry->inode	= inode;
120			   ),
121
122	    TP_printk("o=%p d=%p i=%p",
123		      __entry->obj, __entry->de, __entry->inode)
124	    );
125
126TRACE_EVENT(cachefiles_mkdir,
127	    TP_PROTO(struct cachefiles_object *obj,
128		     struct dentry *de, int ret),
129
130	    TP_ARGS(obj, de, ret),
131
132	    TP_STRUCT__entry(
133		    __field(struct cachefiles_object *,	obj	)
134		    __field(struct dentry *,		de	)
135		    __field(int,			ret	)
136			     ),
137
138	    TP_fast_assign(
139		    __entry->obj	= obj;
140		    __entry->de		= de;
141		    __entry->ret	= ret;
142			   ),
143
144	    TP_printk("o=%p d=%p r=%u",
145		      __entry->obj, __entry->de, __entry->ret)
146	    );
147
148TRACE_EVENT(cachefiles_create,
149	    TP_PROTO(struct cachefiles_object *obj,
150		     struct dentry *de, int ret),
151
152	    TP_ARGS(obj, de, ret),
153
154	    TP_STRUCT__entry(
155		    __field(struct cachefiles_object *,	obj	)
156		    __field(struct dentry *,		de	)
157		    __field(int,			ret	)
158			     ),
159
160	    TP_fast_assign(
161		    __entry->obj	= obj;
162		    __entry->de		= de;
163		    __entry->ret	= ret;
164			   ),
165
166	    TP_printk("o=%p d=%p r=%u",
167		      __entry->obj, __entry->de, __entry->ret)
168	    );
169
170TRACE_EVENT(cachefiles_unlink,
171	    TP_PROTO(struct cachefiles_object *obj,
172		     struct dentry *de,
173		     enum fscache_why_object_killed why),
174
175	    TP_ARGS(obj, de, why),
176
177	    /* Note that obj may be NULL */
178	    TP_STRUCT__entry(
179		    __field(struct cachefiles_object *,	obj		)
180		    __field(struct dentry *,		de		)
181		    __field(enum fscache_why_object_killed, why		)
182			     ),
183
184	    TP_fast_assign(
185		    __entry->obj	= obj;
186		    __entry->de		= de;
187		    __entry->why	= why;
188			   ),
189
190	    TP_printk("o=%p d=%p w=%s",
191		      __entry->obj, __entry->de,
192		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
193	    );
194
195TRACE_EVENT(cachefiles_rename,
196	    TP_PROTO(struct cachefiles_object *obj,
197		     struct dentry *de,
198		     struct dentry *to,
199		     enum fscache_why_object_killed why),
200
201	    TP_ARGS(obj, de, to, why),
202
203	    /* Note that obj may be NULL */
204	    TP_STRUCT__entry(
205		    __field(struct cachefiles_object *,	obj		)
206		    __field(struct dentry *,		de		)
207		    __field(struct dentry *,		to		)
208		    __field(enum fscache_why_object_killed, why		)
209			     ),
210
211	    TP_fast_assign(
212		    __entry->obj	= obj;
213		    __entry->de		= de;
214		    __entry->to		= to;
215		    __entry->why	= why;
216			   ),
217
218	    TP_printk("o=%p d=%p t=%p w=%s",
219		      __entry->obj, __entry->de, __entry->to,
220		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
221	    );
222
223TRACE_EVENT(cachefiles_mark_active,
224	    TP_PROTO(struct cachefiles_object *obj,
225		     struct dentry *de),
226
227	    TP_ARGS(obj, de),
228
229	    /* Note that obj may be NULL */
230	    TP_STRUCT__entry(
231		    __field(struct cachefiles_object *,	obj		)
232		    __field(struct dentry *,		de		)
233			     ),
234
235	    TP_fast_assign(
236		    __entry->obj	= obj;
237		    __entry->de		= de;
238			   ),
239
240	    TP_printk("o=%p d=%p",
241		      __entry->obj, __entry->de)
242	    );
243
244TRACE_EVENT(cachefiles_wait_active,
245	    TP_PROTO(struct cachefiles_object *obj,
246		     struct dentry *de,
247		     struct cachefiles_object *xobj),
248
249	    TP_ARGS(obj, de, xobj),
250
251	    /* Note that obj may be NULL */
252	    TP_STRUCT__entry(
253		    __field(struct cachefiles_object *,	obj		)
254		    __field(struct dentry *,		de		)
255		    __field(struct cachefiles_object *,	xobj		)
256		    __field(u16,			flags		)
257		    __field(u16,			fsc_flags	)
258			     ),
259
260	    TP_fast_assign(
261		    __entry->obj	= obj;
262		    __entry->de		= de;
263		    __entry->xobj	= xobj;
264		    __entry->flags	= xobj->flags;
265		    __entry->fsc_flags	= xobj->fscache.flags;
266			   ),
267
268	    TP_printk("o=%p d=%p wo=%p wf=%x wff=%x",
269		      __entry->obj, __entry->de, __entry->xobj,
270		      __entry->flags, __entry->fsc_flags)
271	    );
272
273TRACE_EVENT(cachefiles_mark_inactive,
274	    TP_PROTO(struct cachefiles_object *obj,
275		     struct dentry *de,
276		     struct inode *inode),
277
278	    TP_ARGS(obj, de, inode),
279
280	    /* Note that obj may be NULL */
281	    TP_STRUCT__entry(
282		    __field(struct cachefiles_object *,	obj		)
283		    __field(struct dentry *,		de		)
284		    __field(struct inode *,		inode		)
285			     ),
286
287	    TP_fast_assign(
288		    __entry->obj	= obj;
289		    __entry->de		= de;
290		    __entry->inode	= inode;
291			   ),
292
293	    TP_printk("o=%p d=%p i=%p",
294		      __entry->obj, __entry->de, __entry->inode)
295	    );
296
297TRACE_EVENT(cachefiles_mark_buried,
298	    TP_PROTO(struct cachefiles_object *obj,
299		     struct dentry *de,
300		     enum fscache_why_object_killed why),
301
302	    TP_ARGS(obj, de, why),
303
304	    /* Note that obj may be NULL */
305	    TP_STRUCT__entry(
306		    __field(struct cachefiles_object *,	obj		)
307		    __field(struct dentry *,		de		)
308		    __field(enum fscache_why_object_killed, why		)
309			     ),
310
311	    TP_fast_assign(
312		    __entry->obj	= obj;
313		    __entry->de		= de;
314		    __entry->why	= why;
315			   ),
316
317	    TP_printk("o=%p d=%p w=%s",
318		      __entry->obj, __entry->de,
319		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
320	    );
321
322#endif /* _TRACE_CACHEFILES_H */
323
324/* This part must be outside protection */
325#include <trace/define_trace.h>