Linux Audio

Check our new training course

Yocto distribution development and maintenance

Need a Yocto distribution for your embedded project?
Loading...
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/* FS-Cache 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 fscache
  9
 10#if !defined(_TRACE_FSCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
 11#define _TRACE_FSCACHE_H
 12
 13#include <linux/fscache.h>
 14#include <linux/tracepoint.h>
 15
 16/*
 17 * Define enums for tracing information.
 18 */
 19#ifndef __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
 20#define __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
 21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 22enum fscache_cookie_trace {
 23	fscache_cookie_collision,
 24	fscache_cookie_discard,
 25	fscache_cookie_get_acquire_parent,
 26	fscache_cookie_get_attach_object,
 27	fscache_cookie_get_reacquire,
 28	fscache_cookie_get_register_netfs,
 29	fscache_cookie_put_acquire_nobufs,
 30	fscache_cookie_put_dup_netfs,
 31	fscache_cookie_put_relinquish,
 
 
 
 32	fscache_cookie_put_object,
 33	fscache_cookie_put_parent,
 34};
 35
 36enum fscache_page_trace {
 37	fscache_page_cached,
 38	fscache_page_inval,
 39	fscache_page_maybe_release,
 40	fscache_page_radix_clear_store,
 41	fscache_page_radix_delete,
 42	fscache_page_radix_insert,
 43	fscache_page_radix_pend2store,
 44	fscache_page_radix_set_pend,
 45	fscache_page_uncache,
 46	fscache_page_write,
 47	fscache_page_write_end,
 48	fscache_page_write_end_pend,
 49	fscache_page_write_end_noc,
 50	fscache_page_write_wait,
 51	fscache_page_trace__nr
 52};
 53
 54enum fscache_op_trace {
 55	fscache_op_cancel,
 56	fscache_op_cancel_all,
 57	fscache_op_cancelled,
 58	fscache_op_completed,
 59	fscache_op_enqueue_async,
 60	fscache_op_enqueue_mythread,
 61	fscache_op_gc,
 62	fscache_op_init,
 63	fscache_op_put,
 64	fscache_op_run,
 65	fscache_op_signal,
 66	fscache_op_submit,
 67	fscache_op_submit_ex,
 68	fscache_op_work,
 69	fscache_op_trace__nr
 70};
 71
 72enum fscache_page_op_trace {
 73	fscache_page_op_alloc_one,
 74	fscache_page_op_attr_changed,
 75	fscache_page_op_check_consistency,
 76	fscache_page_op_invalidate,
 77	fscache_page_op_retr_multi,
 78	fscache_page_op_retr_one,
 79	fscache_page_op_write_one,
 80	fscache_page_op_trace__nr
 
 
 
 
 
 
 
 
 
 
 81};
 82
 83#endif
 84
 85/*
 86 * Declare tracing information enums and their string mappings for display.
 87 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 88#define fscache_cookie_traces						\
 89	EM(fscache_cookie_collision,		"*COLLISION*")		\
 90	EM(fscache_cookie_discard,		"DISCARD")		\
 91	EM(fscache_cookie_get_acquire_parent,	"GET prn")		\
 92	EM(fscache_cookie_get_attach_object,	"GET obj")		\
 93	EM(fscache_cookie_get_reacquire,	"GET raq")		\
 94	EM(fscache_cookie_get_register_netfs,	"GET net")		\
 95	EM(fscache_cookie_put_acquire_nobufs,	"PUT nbf")		\
 96	EM(fscache_cookie_put_dup_netfs,	"PUT dnt")		\
 97	EM(fscache_cookie_put_relinquish,	"PUT rlq")		\
 98	EM(fscache_cookie_put_object,		"PUT obj")		\
 99	E_(fscache_cookie_put_parent,		"PUT prn")
100
101#define fscache_page_traces						\
102	EM(fscache_page_cached,			"Cached ")		\
103	EM(fscache_page_inval,			"InvalPg")		\
104	EM(fscache_page_maybe_release,		"MayRels")		\
105	EM(fscache_page_uncache,		"Uncache")		\
106	EM(fscache_page_radix_clear_store,	"RxCStr ")		\
107	EM(fscache_page_radix_delete,		"RxDel  ")		\
108	EM(fscache_page_radix_insert,		"RxIns  ")		\
109	EM(fscache_page_radix_pend2store,	"RxP2S  ")		\
110	EM(fscache_page_radix_set_pend,		"RxSPend ")		\
111	EM(fscache_page_write,			"WritePg")		\
112	EM(fscache_page_write_end,		"EndPgWr")		\
113	EM(fscache_page_write_end_pend,		"EndPgWP")		\
114	EM(fscache_page_write_end_noc,		"EndPgNC")		\
115	E_(fscache_page_write_wait,		"WtOnWrt")
116
117#define fscache_op_traces						\
118	EM(fscache_op_cancel,			"Cancel1")		\
119	EM(fscache_op_cancel_all,		"CancelA")		\
120	EM(fscache_op_cancelled,		"Canclld")		\
121	EM(fscache_op_completed,		"Complet")		\
122	EM(fscache_op_enqueue_async,		"EnqAsyn")		\
123	EM(fscache_op_enqueue_mythread,		"EnqMyTh")		\
124	EM(fscache_op_gc,			"GC     ")		\
125	EM(fscache_op_init,			"Init   ")		\
126	EM(fscache_op_put,			"Put    ")		\
127	EM(fscache_op_run,			"Run    ")		\
128	EM(fscache_op_signal,			"Signal ")		\
129	EM(fscache_op_submit,			"Submit ")		\
130	EM(fscache_op_submit_ex,		"SubmitX")		\
131	E_(fscache_op_work,			"Work   ")
132
133#define fscache_page_op_traces						\
134	EM(fscache_page_op_alloc_one,		"Alloc1 ")		\
135	EM(fscache_page_op_attr_changed,	"AttrChg")		\
136	EM(fscache_page_op_check_consistency,	"CheckCn")		\
137	EM(fscache_page_op_invalidate,		"Inval  ")		\
138	EM(fscache_page_op_retr_multi,		"RetrMul")		\
139	EM(fscache_page_op_retr_one,		"Retr1  ")		\
140	E_(fscache_page_op_write_one,		"Write1 ")
141
142/*
143 * Export enum symbols via userspace.
144 */
145#undef EM
146#undef E_
147#define EM(a, b) TRACE_DEFINE_ENUM(a);
148#define E_(a, b) TRACE_DEFINE_ENUM(a);
149
 
 
150fscache_cookie_traces;
 
151
152/*
153 * Now redefine the EM() and E_() macros to map the enums to the strings that
154 * will be printed in the output.
155 */
156#undef EM
157#undef E_
158#define EM(a, b)	{ a, b },
159#define E_(a, b)	{ a, b }
160
161
162TRACE_EVENT(fscache_cookie,
163	    TP_PROTO(struct fscache_cookie *cookie,
164		     enum fscache_cookie_trace where,
165		     int usage),
166
167	    TP_ARGS(cookie, where, usage),
168
169	    TP_STRUCT__entry(
170		    __field(struct fscache_cookie *,	cookie		)
171		    __field(struct fscache_cookie *,	parent		)
172		    __field(enum fscache_cookie_trace,	where		)
173		    __field(int,			usage		)
174		    __field(int,			n_children	)
175		    __field(int,			n_active	)
176		    __field(u8,				flags		)
177			     ),
178
179	    TP_fast_assign(
180		    __entry->cookie	= cookie;
181		    __entry->parent	= cookie->parent;
182		    __entry->where	= where;
183		    __entry->usage	= usage;
184		    __entry->n_children	= atomic_read(&cookie->n_children);
185		    __entry->n_active	= atomic_read(&cookie->n_active);
186		    __entry->flags	= cookie->flags;
187			   ),
188
189	    TP_printk("%s c=%p u=%d p=%p Nc=%d Na=%d f=%02x",
190		      __print_symbolic(__entry->where, fscache_cookie_traces),
191		      __entry->cookie, __entry->usage,
192		      __entry->parent, __entry->n_children, __entry->n_active,
193		      __entry->flags)
194	    );
195
196TRACE_EVENT(fscache_netfs,
197	    TP_PROTO(struct fscache_netfs *netfs),
198
199	    TP_ARGS(netfs),
200
201	    TP_STRUCT__entry(
202		    __field(struct fscache_cookie *,	cookie		)
203		    __array(char,			name, 8		)
204			     ),
205
206	    TP_fast_assign(
207		    __entry->cookie		= netfs->primary_index;
208		    strncpy(__entry->name, netfs->name, 8);
209		    __entry->name[7]		= 0;
210			   ),
211
212	    TP_printk("c=%p n=%s",
213		      __entry->cookie, __entry->name)
 
 
214	    );
215
216TRACE_EVENT(fscache_acquire,
217	    TP_PROTO(struct fscache_cookie *cookie),
 
 
218
219	    TP_ARGS(cookie),
220
221	    TP_STRUCT__entry(
222		    __field(struct fscache_cookie *,	cookie		)
223		    __field(struct fscache_cookie *,	parent		)
224		    __array(char,			name, 8		)
225		    __field(int,			p_usage		)
226		    __field(int,			p_n_children	)
227		    __field(u8,				p_flags		)
228			     ),
229
230	    TP_fast_assign(
231		    __entry->cookie		= cookie;
232		    __entry->parent		= cookie->parent;
233		    __entry->p_usage		= atomic_read(&cookie->parent->usage);
234		    __entry->p_n_children	= atomic_read(&cookie->parent->n_children);
235		    __entry->p_flags		= cookie->parent->flags;
236		    memcpy(__entry->name, cookie->def->name, 8);
237		    __entry->name[7]		= 0;
238			   ),
239
240	    TP_printk("c=%p p=%p pu=%d pc=%d pf=%02x n=%s",
241		      __entry->cookie, __entry->parent, __entry->p_usage,
242		      __entry->p_n_children, __entry->p_flags, __entry->name)
243	    );
244
245TRACE_EVENT(fscache_relinquish,
246	    TP_PROTO(struct fscache_cookie *cookie, bool retire),
247
248	    TP_ARGS(cookie, retire),
249
250	    TP_STRUCT__entry(
251		    __field(struct fscache_cookie *,	cookie		)
252		    __field(struct fscache_cookie *,	parent		)
253		    __field(int,			usage		)
254		    __field(int,			n_children	)
255		    __field(int,			n_active	)
256		    __field(u8,				flags		)
257		    __field(bool,			retire		)
258			     ),
259
260	    TP_fast_assign(
261		    __entry->cookie	= cookie;
262		    __entry->parent	= cookie->parent;
263		    __entry->usage	= atomic_read(&cookie->usage);
264		    __entry->n_children	= atomic_read(&cookie->n_children);
265		    __entry->n_active	= atomic_read(&cookie->n_active);
266		    __entry->flags	= cookie->flags;
267		    __entry->retire	= retire;
268			   ),
269
270	    TP_printk("c=%p u=%d p=%p Nc=%d Na=%d f=%02x r=%u",
271		      __entry->cookie, __entry->usage,
272		      __entry->parent, __entry->n_children, __entry->n_active,
273		      __entry->flags, __entry->retire)
274	    );
275
276TRACE_EVENT(fscache_enable,
277	    TP_PROTO(struct fscache_cookie *cookie),
 
 
278
279	    TP_ARGS(cookie),
280
281	    TP_STRUCT__entry(
282		    __field(struct fscache_cookie *,	cookie		)
283		    __field(int,			usage		)
284		    __field(int,			n_children	)
285		    __field(int,			n_active	)
286		    __field(u8,				flags		)
287			     ),
288
289	    TP_fast_assign(
290		    __entry->cookie	= cookie;
291		    __entry->usage	= atomic_read(&cookie->usage);
292		    __entry->n_children	= atomic_read(&cookie->n_children);
293		    __entry->n_active	= atomic_read(&cookie->n_active);
294		    __entry->flags	= cookie->flags;
295			   ),
296
297	    TP_printk("c=%p u=%d Nc=%d Na=%d f=%02x",
298		      __entry->cookie, __entry->usage,
299		      __entry->n_children, __entry->n_active, __entry->flags)
 
300	    );
301
302TRACE_EVENT(fscache_disable,
303	    TP_PROTO(struct fscache_cookie *cookie),
 
 
 
 
304
305	    TP_ARGS(cookie),
306
307	    TP_STRUCT__entry(
308		    __field(struct fscache_cookie *,	cookie		)
309		    __field(int,			usage		)
310		    __field(int,			n_children	)
311		    __field(int,			n_active	)
312		    __field(u8,				flags		)
 
313			     ),
314
315	    TP_fast_assign(
316		    __entry->cookie	= cookie;
317		    __entry->usage	= atomic_read(&cookie->usage);
318		    __entry->n_children	= atomic_read(&cookie->n_children);
319		    __entry->n_active	= atomic_read(&cookie->n_active);
320		    __entry->flags	= cookie->flags;
321			   ),
322
323	    TP_printk("c=%p u=%d Nc=%d Na=%d f=%02x",
324		      __entry->cookie, __entry->usage,
325		      __entry->n_children, __entry->n_active, __entry->flags)
 
 
 
326	    );
327
328TRACE_EVENT(fscache_osm,
329	    TP_PROTO(struct fscache_object *object,
330		     const struct fscache_state *state,
331		     bool wait, bool oob, s8 event_num),
 
332
333	    TP_ARGS(object, state, wait, oob, event_num),
334
335	    TP_STRUCT__entry(
336		    __field(struct fscache_cookie *,	cookie		)
337		    __field(struct fscache_object *,	object		)
338		    __array(char,			state, 8	)
339		    __field(bool,			wait		)
340		    __field(bool,			oob		)
341		    __field(s8,				event_num	)
342			     ),
343
344	    TP_fast_assign(
345		    __entry->cookie		= object->cookie;
346		    __entry->object		= object;
347		    __entry->wait		= wait;
348		    __entry->oob		= oob;
349		    __entry->event_num		= event_num;
350		    memcpy(__entry->state, state->short_name, 8);
351			   ),
352
353	    TP_printk("c=%p o=%p %s %s%sev=%d",
354		      __entry->cookie,
355		      __entry->object,
356		      __entry->state,
357		      __print_symbolic(__entry->wait,
358				       { true,  "WAIT" },
359				       { false, "WORK" }),
360		      __print_symbolic(__entry->oob,
361				       { true,  " OOB " },
362				       { false, " " }),
363		      __entry->event_num)
364	    );
365
366TRACE_EVENT(fscache_page,
367	    TP_PROTO(struct fscache_cookie *cookie, struct page *page,
368		     enum fscache_page_trace why),
 
 
 
369
370	    TP_ARGS(cookie, page, why),
371
372	    TP_STRUCT__entry(
373		    __field(struct fscache_cookie *,	cookie		)
374		    __field(pgoff_t,			page		)
375		    __field(enum fscache_page_trace,	why		)
 
 
376			     ),
377
378	    TP_fast_assign(
379		    __entry->cookie		= cookie;
380		    __entry->page		= page->index;
381		    __entry->why		= why;
 
 
382			   ),
383
384	    TP_printk("c=%p %s pg=%lx",
 
385		      __entry->cookie,
386		      __print_symbolic(__entry->why, fscache_page_traces),
387		      __entry->page)
 
388	    );
389
390TRACE_EVENT(fscache_check_page,
391	    TP_PROTO(struct fscache_cookie *cookie, struct page *page,
392		     void *val, int n),
 
 
393
394	    TP_ARGS(cookie, page, val, n),
395
396	    TP_STRUCT__entry(
397		    __field(struct fscache_cookie *,	cookie		)
398		    __field(void *,			page		)
399		    __field(void *,			val		)
400		    __field(int,			n		)
401			     ),
402
403	    TP_fast_assign(
404		    __entry->cookie		= cookie;
405		    __entry->page		= page;
406		    __entry->val		= val;
407		    __entry->n			= n;
408			   ),
409
410	    TP_printk("c=%p pg=%p val=%p n=%d",
411		      __entry->cookie, __entry->page, __entry->val, __entry->n)
 
 
 
412	    );
413
414TRACE_EVENT(fscache_wake_cookie,
415	    TP_PROTO(struct fscache_cookie *cookie),
416
417	    TP_ARGS(cookie),
418
419	    TP_STRUCT__entry(
420		    __field(struct fscache_cookie *,	cookie		)
421			     ),
422
423	    TP_fast_assign(
424		    __entry->cookie		= cookie;
425			   ),
426
427	    TP_printk("c=%p", __entry->cookie)
428	    );
429
430TRACE_EVENT(fscache_op,
431	    TP_PROTO(struct fscache_cookie *cookie, struct fscache_operation *op,
432		     enum fscache_op_trace why),
433
434	    TP_ARGS(cookie, op, why),
435
436	    TP_STRUCT__entry(
437		    __field(struct fscache_cookie *,	cookie		)
438		    __field(struct fscache_operation *,	op		)
439		    __field(enum fscache_op_trace,	why		)
440			     ),
441
442	    TP_fast_assign(
443		    __entry->cookie		= cookie;
444		    __entry->op			= op;
445		    __entry->why		= why;
 
446			   ),
447
448	    TP_printk("c=%p op=%p %s",
449		      __entry->cookie, __entry->op,
450		      __print_symbolic(__entry->why, fscache_op_traces))
451	    );
452
453TRACE_EVENT(fscache_page_op,
454	    TP_PROTO(struct fscache_cookie *cookie, struct page *page,
455		     struct fscache_operation *op, enum fscache_page_op_trace what),
456
457	    TP_ARGS(cookie, page, op, what),
458
459	    TP_STRUCT__entry(
460		    __field(struct fscache_cookie *,	cookie		)
461		    __field(pgoff_t,			page		)
462		    __field(struct fscache_operation *,	op		)
463		    __field(enum fscache_page_op_trace,	what		)
 
 
464			     ),
465
466	    TP_fast_assign(
467		    __entry->cookie		= cookie;
468		    __entry->page		= page ? page->index : 0;
469		    __entry->op			= op;
470		    __entry->what		= what;
 
 
471			   ),
472
473	    TP_printk("c=%p %s pg=%lx op=%p",
474		      __entry->cookie,
475		      __print_symbolic(__entry->what, fscache_page_op_traces),
476		      __entry->page, __entry->op)
477	    );
478
479TRACE_EVENT(fscache_wrote_page,
480	    TP_PROTO(struct fscache_cookie *cookie, struct page *page,
481		     struct fscache_operation *op, int ret),
482
483	    TP_ARGS(cookie, page, op, ret),
484
485	    TP_STRUCT__entry(
486		    __field(struct fscache_cookie *,	cookie		)
487		    __field(pgoff_t,			page		)
488		    __field(struct fscache_operation *,	op		)
489		    __field(int,			ret		)
490			     ),
491
492	    TP_fast_assign(
493		    __entry->cookie		= cookie;
494		    __entry->page		= page->index;
495		    __entry->op			= op;
496		    __entry->ret		= ret;
497			   ),
498
499	    TP_printk("c=%p pg=%lx op=%p ret=%d",
500		      __entry->cookie, __entry->page, __entry->op, __entry->ret)
501	    );
502
503TRACE_EVENT(fscache_gang_lookup,
504	    TP_PROTO(struct fscache_cookie *cookie, struct fscache_operation *op,
505		     void **results, int n, pgoff_t store_limit),
506
507	    TP_ARGS(cookie, op, results, n, store_limit),
508
509	    TP_STRUCT__entry(
510		    __field(struct fscache_cookie *,	cookie		)
511		    __field(struct fscache_operation *,	op		)
512		    __field(pgoff_t,			results0	)
513		    __field(int,			n		)
514		    __field(pgoff_t,			store_limit	)
515			     ),
516
517	    TP_fast_assign(
518		    __entry->cookie		= cookie;
519		    __entry->op			= op;
520		    __entry->results0		= results[0] ? ((struct page *)results[0])->index : (pgoff_t)-1;
521		    __entry->n			= n;
522		    __entry->store_limit	= store_limit;
523			   ),
524
525	    TP_printk("c=%p op=%p r0=%lx n=%d sl=%lx",
526		      __entry->cookie, __entry->op, __entry->results0, __entry->n,
527		      __entry->store_limit)
 
528	    );
529
530#endif /* _TRACE_FSCACHE_H */
531
532/* This part must be outside protection */
533#include <trace/define_trace.h>
v6.13.7
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/* FS-Cache tracepoints
  3 *
  4 * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
  5 * Written by David Howells (dhowells@redhat.com)
  6 */
  7#undef TRACE_SYSTEM
  8#define TRACE_SYSTEM fscache
  9
 10#if !defined(_TRACE_FSCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
 11#define _TRACE_FSCACHE_H
 12
 13#include <linux/fscache.h>
 14#include <linux/tracepoint.h>
 15
 16/*
 17 * Define enums for tracing information.
 18 */
 19#ifndef __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
 20#define __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
 21
 22enum fscache_cache_trace {
 23	fscache_cache_collision,
 24	fscache_cache_get_acquire,
 25	fscache_cache_new_acquire,
 26	fscache_cache_put_alloc_volume,
 27	fscache_cache_put_cache,
 28	fscache_cache_put_prep_failed,
 29	fscache_cache_put_relinquish,
 30	fscache_cache_put_volume,
 31};
 32
 33enum fscache_volume_trace {
 34	fscache_volume_collision,
 35	fscache_volume_get_cookie,
 36	fscache_volume_get_create_work,
 37	fscache_volume_get_hash_collision,
 38	fscache_volume_get_withdraw,
 39	fscache_volume_free,
 40	fscache_volume_new_acquire,
 41	fscache_volume_put_cookie,
 42	fscache_volume_put_create_work,
 43	fscache_volume_put_hash_collision,
 44	fscache_volume_put_relinquish,
 45	fscache_volume_put_withdraw,
 46	fscache_volume_see_create_work,
 47	fscache_volume_see_hash_wake,
 48	fscache_volume_wait_create_work,
 49};
 50
 51enum fscache_cookie_trace {
 52	fscache_cookie_collision,
 53	fscache_cookie_discard,
 54	fscache_cookie_failed,
 55	fscache_cookie_get_attach_object,
 56	fscache_cookie_get_end_access,
 57	fscache_cookie_get_hash_collision,
 58	fscache_cookie_get_inval_work,
 59	fscache_cookie_get_lru,
 60	fscache_cookie_get_use_work,
 61	fscache_cookie_new_acquire,
 62	fscache_cookie_put_hash_collision,
 63	fscache_cookie_put_lru,
 64	fscache_cookie_put_object,
 65	fscache_cookie_put_over_queued,
 66	fscache_cookie_put_relinquish,
 67	fscache_cookie_put_withdrawn,
 68	fscache_cookie_put_work,
 69	fscache_cookie_see_active,
 70	fscache_cookie_see_lru_discard,
 71	fscache_cookie_see_lru_discard_clear,
 72	fscache_cookie_see_lru_do_one,
 73	fscache_cookie_see_relinquish,
 74	fscache_cookie_see_withdraw,
 75	fscache_cookie_see_work,
 
 
 
 
 
 
 
 
 76};
 77
 78enum fscache_active_trace {
 79	fscache_active_use,
 80	fscache_active_use_modify,
 81	fscache_active_unuse,
 
 
 
 
 
 
 
 
 
 
 
 
 82};
 83
 84enum fscache_access_trace {
 85	fscache_access_acquire_volume,
 86	fscache_access_acquire_volume_end,
 87	fscache_access_cache_pin,
 88	fscache_access_cache_unpin,
 89	fscache_access_invalidate_cookie,
 90	fscache_access_invalidate_cookie_end,
 91	fscache_access_io_end,
 92	fscache_access_io_not_live,
 93	fscache_access_io_read,
 94	fscache_access_io_resize,
 95	fscache_access_io_wait,
 96	fscache_access_io_write,
 97	fscache_access_lookup_cookie,
 98	fscache_access_lookup_cookie_end,
 99	fscache_access_lookup_cookie_end_failed,
100	fscache_access_relinquish_volume,
101	fscache_access_relinquish_volume_end,
102	fscache_access_unlive,
103};
104
105#endif
106
107/*
108 * Declare tracing information enums and their string mappings for display.
109 */
110#define fscache_cache_traces						\
111	EM(fscache_cache_collision,		"*COLLIDE*")		\
112	EM(fscache_cache_get_acquire,		"GET acq  ")		\
113	EM(fscache_cache_new_acquire,		"NEW acq  ")		\
114	EM(fscache_cache_put_alloc_volume,	"PUT alvol")		\
115	EM(fscache_cache_put_cache,		"PUT cache")		\
116	EM(fscache_cache_put_prep_failed,	"PUT pfail")		\
117	EM(fscache_cache_put_relinquish,	"PUT relnq")		\
118	E_(fscache_cache_put_volume,		"PUT vol  ")
119
120#define fscache_volume_traces						\
121	EM(fscache_volume_collision,		"*COLLIDE*")		\
122	EM(fscache_volume_get_cookie,		"GET cook ")		\
123	EM(fscache_volume_get_create_work,	"GET creat")		\
124	EM(fscache_volume_get_hash_collision,	"GET hcoll")		\
125	EM(fscache_volume_get_withdraw,		"GET withd")            \
126	EM(fscache_volume_free,			"FREE     ")		\
127	EM(fscache_volume_new_acquire,		"NEW acq  ")		\
128	EM(fscache_volume_put_cookie,		"PUT cook ")		\
129	EM(fscache_volume_put_create_work,	"PUT creat")		\
130	EM(fscache_volume_put_hash_collision,	"PUT hcoll")		\
131	EM(fscache_volume_put_relinquish,	"PUT relnq")		\
132	EM(fscache_volume_put_withdraw,		"PUT withd")            \
133	EM(fscache_volume_see_create_work,	"SEE creat")		\
134	EM(fscache_volume_see_hash_wake,	"SEE hwake")		\
135	E_(fscache_volume_wait_create_work,	"WAIT crea")
136
137#define fscache_cookie_traces						\
138	EM(fscache_cookie_collision,		"*COLLIDE*")		\
139	EM(fscache_cookie_discard,		"DISCARD  ")		\
140	EM(fscache_cookie_failed,		"FAILED   ")		\
141	EM(fscache_cookie_get_attach_object,	"GET attch")		\
142	EM(fscache_cookie_get_hash_collision,	"GET hcoll")		\
143	EM(fscache_cookie_get_end_access,	"GQ  endac")		\
144	EM(fscache_cookie_get_inval_work,	"GQ  inval")		\
145	EM(fscache_cookie_get_lru,		"GET lru  ")		\
146	EM(fscache_cookie_get_use_work,		"GQ  use  ")		\
147	EM(fscache_cookie_new_acquire,		"NEW acq  ")		\
148	EM(fscache_cookie_put_hash_collision,	"PUT hcoll")		\
149	EM(fscache_cookie_put_lru,		"PUT lru  ")		\
150	EM(fscache_cookie_put_object,		"PUT obj  ")		\
151	EM(fscache_cookie_put_over_queued,	"PQ  overq")		\
152	EM(fscache_cookie_put_relinquish,	"PUT relnq")		\
153	EM(fscache_cookie_put_withdrawn,	"PUT wthdn")		\
154	EM(fscache_cookie_put_work,		"PQ  work ")		\
155	EM(fscache_cookie_see_active,		"-   activ")		\
156	EM(fscache_cookie_see_lru_discard,	"-   x-lru")		\
157	EM(fscache_cookie_see_lru_discard_clear,"-   lrudc")            \
158	EM(fscache_cookie_see_lru_do_one,	"-   lrudo")		\
159	EM(fscache_cookie_see_relinquish,	"-   x-rlq")		\
160	EM(fscache_cookie_see_withdraw,		"-   x-wth")		\
161	E_(fscache_cookie_see_work,		"-   work ")
162
163#define fscache_active_traces		\
164	EM(fscache_active_use,			"USE          ")	\
165	EM(fscache_active_use_modify,		"USE-m        ")	\
166	E_(fscache_active_unuse,		"UNUSE        ")
167
168#define fscache_access_traces		\
169	EM(fscache_access_acquire_volume,	"BEGIN acq_vol")	\
170	EM(fscache_access_acquire_volume_end,	"END   acq_vol")	\
171	EM(fscache_access_cache_pin,		"PIN   cache  ")	\
172	EM(fscache_access_cache_unpin,		"UNPIN cache  ")	\
173	EM(fscache_access_invalidate_cookie,	"BEGIN inval  ")	\
174	EM(fscache_access_invalidate_cookie_end,"END   inval  ")	\
175	EM(fscache_access_io_end,		"END   io     ")	\
176	EM(fscache_access_io_not_live,		"END   io_notl")	\
177	EM(fscache_access_io_read,		"BEGIN io_read")	\
178	EM(fscache_access_io_resize,		"BEGIN io_resz")	\
179	EM(fscache_access_io_wait,		"WAIT  io     ")	\
180	EM(fscache_access_io_write,		"BEGIN io_writ")	\
181	EM(fscache_access_lookup_cookie,	"BEGIN lookup ")	\
182	EM(fscache_access_lookup_cookie_end,	"END   lookup ")	\
183	EM(fscache_access_lookup_cookie_end_failed,"END   lookupf")	\
184	EM(fscache_access_relinquish_volume,	"BEGIN rlq_vol")	\
185	EM(fscache_access_relinquish_volume_end,"END   rlq_vol")	\
186	E_(fscache_access_unlive,		"END   unlive ")
 
 
 
187
188/*
189 * Export enum symbols via userspace.
190 */
191#undef EM
192#undef E_
193#define EM(a, b) TRACE_DEFINE_ENUM(a);
194#define E_(a, b) TRACE_DEFINE_ENUM(a);
195
196fscache_cache_traces;
197fscache_volume_traces;
198fscache_cookie_traces;
199fscache_access_traces;
200
201/*
202 * Now redefine the EM() and E_() macros to map the enums to the strings that
203 * will be printed in the output.
204 */
205#undef EM
206#undef E_
207#define EM(a, b)	{ a, b },
208#define E_(a, b)	{ a, b }
209
210
211TRACE_EVENT(fscache_cache,
212	    TP_PROTO(unsigned int cache_debug_id,
213		     int usage,
214		     enum fscache_cache_trace where),
215
216	    TP_ARGS(cache_debug_id, usage, where),
217
218	    TP_STRUCT__entry(
219		    __field(unsigned int,		cache		)
 
 
220		    __field(int,			usage		)
221		    __field(enum fscache_cache_trace,	where		)
 
 
222			     ),
223
224	    TP_fast_assign(
225		    __entry->cache	= cache_debug_id;
 
 
226		    __entry->usage	= usage;
227		    __entry->where	= where;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228			   ),
229
230	    TP_printk("C=%08x %s r=%d",
231		      __entry->cache,
232		      __print_symbolic(__entry->where, fscache_cache_traces),
233		      __entry->usage)
234	    );
235
236TRACE_EVENT(fscache_volume,
237	    TP_PROTO(unsigned int volume_debug_id,
238		     int usage,
239		     enum fscache_volume_trace where),
240
241	    TP_ARGS(volume_debug_id, usage, where),
242
243	    TP_STRUCT__entry(
244		    __field(unsigned int,		volume		)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245		    __field(int,			usage		)
246		    __field(enum fscache_volume_trace,	where		)
 
 
 
247			     ),
248
249	    TP_fast_assign(
250		    __entry->volume	= volume_debug_id;
251		    __entry->usage	= usage;
252		    __entry->where	= where;
 
 
 
 
253			   ),
254
255	    TP_printk("V=%08x %s u=%d",
256		      __entry->volume,
257		      __print_symbolic(__entry->where, fscache_volume_traces),
258		      __entry->usage)
259	    );
260
261TRACE_EVENT(fscache_cookie,
262	    TP_PROTO(unsigned int cookie_debug_id,
263		     int ref,
264		     enum fscache_cookie_trace where),
265
266	    TP_ARGS(cookie_debug_id, ref, where),
267
268	    TP_STRUCT__entry(
269		    __field(unsigned int,		cookie		)
270		    __field(int,			ref		)
271		    __field(enum fscache_cookie_trace,	where		)
 
 
272			     ),
273
274	    TP_fast_assign(
275		    __entry->cookie	= cookie_debug_id;
276		    __entry->ref	= ref;
277		    __entry->where	= where;
 
 
278			   ),
279
280	    TP_printk("c=%08x %s r=%d",
281		      __entry->cookie,
282		      __print_symbolic(__entry->where, fscache_cookie_traces),
283		      __entry->ref)
284	    );
285
286TRACE_EVENT(fscache_active,
287	    TP_PROTO(unsigned int cookie_debug_id,
288		     int ref,
289		     int n_active,
290		     int n_accesses,
291		     enum fscache_active_trace why),
292
293	    TP_ARGS(cookie_debug_id, ref, n_active, n_accesses, why),
294
295	    TP_STRUCT__entry(
296		    __field(unsigned int,		cookie		)
297		    __field(int,			ref		)
 
298		    __field(int,			n_active	)
299		    __field(int,			n_accesses	)
300		    __field(enum fscache_active_trace,	why		)
301			     ),
302
303	    TP_fast_assign(
304		    __entry->cookie	= cookie_debug_id;
305		    __entry->ref	= ref;
306		    __entry->n_active	= n_active;
307		    __entry->n_accesses	= n_accesses;
308		    __entry->why	= why;
309			   ),
310
311	    TP_printk("c=%08x %s r=%d a=%d c=%d",
312		      __entry->cookie,
313		      __print_symbolic(__entry->why, fscache_active_traces),
314		      __entry->ref,
315		      __entry->n_accesses,
316		      __entry->n_active)
317	    );
318
319TRACE_EVENT(fscache_access_cache,
320	    TP_PROTO(unsigned int cache_debug_id,
321		     int ref,
322		     int n_accesses,
323		     enum fscache_access_trace why),
324
325	    TP_ARGS(cache_debug_id, ref, n_accesses, why),
326
327	    TP_STRUCT__entry(
328		    __field(unsigned int,		cache		)
329		    __field(int,			ref		)
330		    __field(int,			n_accesses	)
331		    __field(enum fscache_access_trace,	why		)
 
 
332			     ),
333
334	    TP_fast_assign(
335		    __entry->cache	= cache_debug_id;
336		    __entry->ref	= ref;
337		    __entry->n_accesses	= n_accesses;
338		    __entry->why	= why;
 
 
339			   ),
340
341	    TP_printk("C=%08x %s r=%d a=%d",
342		      __entry->cache,
343		      __print_symbolic(__entry->why, fscache_access_traces),
344		      __entry->ref,
345		      __entry->n_accesses)
 
 
 
 
 
 
346	    );
347
348TRACE_EVENT(fscache_access_volume,
349	    TP_PROTO(unsigned int volume_debug_id,
350		     unsigned int cookie_debug_id,
351		     int ref,
352		     int n_accesses,
353		     enum fscache_access_trace why),
354
355	    TP_ARGS(volume_debug_id, cookie_debug_id, ref, n_accesses, why),
356
357	    TP_STRUCT__entry(
358		    __field(unsigned int,		volume		)
359		    __field(unsigned int,		cookie		)
360		    __field(int,			ref		)
361		    __field(int,			n_accesses	)
362		    __field(enum fscache_access_trace,	why		)
363			     ),
364
365	    TP_fast_assign(
366		    __entry->volume	= volume_debug_id;
367		    __entry->cookie	= cookie_debug_id;
368		    __entry->ref	= ref;
369		    __entry->n_accesses	= n_accesses;
370		    __entry->why	= why;
371			   ),
372
373	    TP_printk("V=%08x c=%08x %s r=%d a=%d",
374		      __entry->volume,
375		      __entry->cookie,
376		      __print_symbolic(__entry->why, fscache_access_traces),
377		      __entry->ref,
378		      __entry->n_accesses)
379	    );
380
381TRACE_EVENT(fscache_access,
382	    TP_PROTO(unsigned int cookie_debug_id,
383		     int ref,
384		     int n_accesses,
385		     enum fscache_access_trace why),
386
387	    TP_ARGS(cookie_debug_id, ref, n_accesses, why),
388
389	    TP_STRUCT__entry(
390		    __field(unsigned int,		cookie		)
391		    __field(int,			ref		)
392		    __field(int,			n_accesses	)
393		    __field(enum fscache_access_trace,	why		)
394			     ),
395
396	    TP_fast_assign(
397		    __entry->cookie	= cookie_debug_id;
398		    __entry->ref	= ref;
399		    __entry->n_accesses	= n_accesses;
400		    __entry->why	= why;
401			   ),
402
403	    TP_printk("c=%08x %s r=%d a=%d",
404		      __entry->cookie,
405		      __print_symbolic(__entry->why, fscache_access_traces),
406		      __entry->ref,
407		      __entry->n_accesses)
408	    );
409
410TRACE_EVENT(fscache_acquire,
411	    TP_PROTO(struct fscache_cookie *cookie),
412
413	    TP_ARGS(cookie),
414
415	    TP_STRUCT__entry(
416		    __field(unsigned int,		cookie		)
417		    __field(unsigned int,		volume		)
418		    __field(int,			v_ref		)
419		    __field(int,			v_n_cookies	)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420			     ),
421
422	    TP_fast_assign(
423		    __entry->cookie		= cookie->debug_id;
424		    __entry->volume		= cookie->volume->debug_id;
425		    __entry->v_ref		= refcount_read(&cookie->volume->ref);
426		    __entry->v_n_cookies	= atomic_read(&cookie->volume->n_cookies);
427			   ),
428
429	    TP_printk("c=%08x V=%08x vr=%d vc=%d",
430		      __entry->cookie,
431		      __entry->volume, __entry->v_ref, __entry->v_n_cookies)
432	    );
433
434TRACE_EVENT(fscache_relinquish,
435	    TP_PROTO(struct fscache_cookie *cookie, bool retire),
 
436
437	    TP_ARGS(cookie, retire),
438
439	    TP_STRUCT__entry(
440		    __field(unsigned int,		cookie		)
441		    __field(unsigned int,		volume		)
442		    __field(int,			ref		)
443		    __field(int,			n_active	)
444		    __field(u8,				flags		)
445		    __field(bool,			retire		)
446			     ),
447
448	    TP_fast_assign(
449		    __entry->cookie	= cookie->debug_id;
450		    __entry->volume	= cookie->volume->debug_id;
451		    __entry->ref	= refcount_read(&cookie->ref);
452		    __entry->n_active	= atomic_read(&cookie->n_active);
453		    __entry->flags	= cookie->flags;
454		    __entry->retire	= retire;
455			   ),
456
457	    TP_printk("c=%08x V=%08x r=%d U=%d f=%02x rt=%u",
458		      __entry->cookie, __entry->volume, __entry->ref,
459		      __entry->n_active, __entry->flags, __entry->retire)
 
460	    );
461
462TRACE_EVENT(fscache_invalidate,
463	    TP_PROTO(struct fscache_cookie *cookie, loff_t new_size),
 
464
465	    TP_ARGS(cookie, new_size),
466
467	    TP_STRUCT__entry(
468		    __field(unsigned int,		cookie		)
469		    __field(loff_t,			new_size	)
 
 
470			     ),
471
472	    TP_fast_assign(
473		    __entry->cookie	= cookie->debug_id;
474		    __entry->new_size	= new_size;
 
 
475			   ),
476
477	    TP_printk("c=%08x sz=%llx",
478		      __entry->cookie, __entry->new_size)
479	    );
480
481TRACE_EVENT(fscache_resize,
482	    TP_PROTO(struct fscache_cookie *cookie, loff_t new_size),
 
483
484	    TP_ARGS(cookie, new_size),
485
486	    TP_STRUCT__entry(
487		    __field(unsigned int,		cookie		)
488		    __field(loff_t,			old_size	)
489		    __field(loff_t,			new_size	)
 
 
490			     ),
491
492	    TP_fast_assign(
493		    __entry->cookie	= cookie->debug_id;
494		    __entry->old_size	= cookie->object_size;
495		    __entry->new_size	= new_size;
 
 
496			   ),
497
498	    TP_printk("c=%08x os=%08llx sz=%08llx",
499		      __entry->cookie,
500		      __entry->old_size,
501		      __entry->new_size)
502	    );
503
504#endif /* _TRACE_FSCACHE_H */
505
506/* This part must be outside protection */
507#include <trace/define_trace.h>