xref: /linux/include/trace/events/cachefiles.h (revision b4db9f840283caca0d904436f187ef56a9126eaa)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* CacheFiles 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 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 
21 enum cachefiles_obj_ref_trace {
22 	cachefiles_obj_get_ioreq,
23 	cachefiles_obj_new,
24 	cachefiles_obj_put_alloc_fail,
25 	cachefiles_obj_put_detach,
26 	cachefiles_obj_put_ioreq,
27 	cachefiles_obj_see_clean_commit,
28 	cachefiles_obj_see_clean_delete,
29 	cachefiles_obj_see_clean_drop_tmp,
30 	cachefiles_obj_see_lookup_cookie,
31 	cachefiles_obj_see_lookup_failed,
32 	cachefiles_obj_see_withdraw_cookie,
33 	cachefiles_obj_see_withdrawal,
34 	cachefiles_obj_get_ondemand_fd,
35 	cachefiles_obj_put_ondemand_fd,
36 };
37 
38 enum fscache_why_object_killed {
39 	FSCACHE_OBJECT_IS_STALE,
40 	FSCACHE_OBJECT_IS_WEIRD,
41 	FSCACHE_OBJECT_INVALIDATED,
42 	FSCACHE_OBJECT_NO_SPACE,
43 	FSCACHE_OBJECT_WAS_RETIRED,
44 	FSCACHE_OBJECT_WAS_CULLED,
45 	FSCACHE_VOLUME_IS_WEIRD,
46 };
47 
48 enum cachefiles_coherency_trace {
49 	cachefiles_coherency_check_aux,
50 	cachefiles_coherency_check_content,
51 	cachefiles_coherency_check_dirty,
52 	cachefiles_coherency_check_len,
53 	cachefiles_coherency_check_objsize,
54 	cachefiles_coherency_check_ok,
55 	cachefiles_coherency_check_type,
56 	cachefiles_coherency_check_xattr,
57 	cachefiles_coherency_set_fail,
58 	cachefiles_coherency_set_ok,
59 	cachefiles_coherency_vol_check_cmp,
60 	cachefiles_coherency_vol_check_ok,
61 	cachefiles_coherency_vol_check_resv,
62 	cachefiles_coherency_vol_check_xattr,
63 	cachefiles_coherency_vol_set_fail,
64 	cachefiles_coherency_vol_set_ok,
65 };
66 
67 enum cachefiles_trunc_trace {
68 	cachefiles_trunc_dio_adjust,
69 	cachefiles_trunc_expand_tmpfile,
70 	cachefiles_trunc_shrink,
71 };
72 
73 enum cachefiles_prepare_read_trace {
74 	cachefiles_trace_read_after_eof,
75 	cachefiles_trace_read_found_hole,
76 	cachefiles_trace_read_found_part,
77 	cachefiles_trace_read_have_data,
78 	cachefiles_trace_read_no_data,
79 	cachefiles_trace_read_no_file,
80 	cachefiles_trace_read_seek_error,
81 	cachefiles_trace_read_seek_nxio,
82 };
83 
84 enum cachefiles_error_trace {
85 	cachefiles_trace_fallocate_error,
86 	cachefiles_trace_getxattr_error,
87 	cachefiles_trace_link_error,
88 	cachefiles_trace_lookup_error,
89 	cachefiles_trace_mkdir_error,
90 	cachefiles_trace_notify_change_error,
91 	cachefiles_trace_open_error,
92 	cachefiles_trace_read_error,
93 	cachefiles_trace_remxattr_error,
94 	cachefiles_trace_rename_error,
95 	cachefiles_trace_seek_error,
96 	cachefiles_trace_setxattr_error,
97 	cachefiles_trace_statfs_error,
98 	cachefiles_trace_tmpfile_error,
99 	cachefiles_trace_trunc_error,
100 	cachefiles_trace_unlink_error,
101 	cachefiles_trace_write_error,
102 };
103 
104 #endif
105 
106 /*
107  * Define enum -> string mappings for display.
108  */
109 #define cachefiles_obj_kill_traces				\
110 	EM(FSCACHE_OBJECT_IS_STALE,	"stale")		\
111 	EM(FSCACHE_OBJECT_IS_WEIRD,	"weird")		\
112 	EM(FSCACHE_OBJECT_INVALIDATED,	"inval")		\
113 	EM(FSCACHE_OBJECT_NO_SPACE,	"no_space")		\
114 	EM(FSCACHE_OBJECT_WAS_RETIRED,	"was_retired")		\
115 	EM(FSCACHE_OBJECT_WAS_CULLED,	"was_culled")		\
116 	E_(FSCACHE_VOLUME_IS_WEIRD,	"volume_weird")
117 
118 #define cachefiles_obj_ref_traces					\
119 	EM(cachefiles_obj_get_ioreq,		"GET ioreq")		\
120 	EM(cachefiles_obj_new,			"NEW obj")		\
121 	EM(cachefiles_obj_put_alloc_fail,	"PUT alloc_fail")	\
122 	EM(cachefiles_obj_put_detach,		"PUT detach")		\
123 	EM(cachefiles_obj_put_ioreq,		"PUT ioreq")		\
124 	EM(cachefiles_obj_see_clean_commit,	"SEE clean_commit")	\
125 	EM(cachefiles_obj_see_clean_delete,	"SEE clean_delete")	\
126 	EM(cachefiles_obj_see_clean_drop_tmp,	"SEE clean_drop_tmp")	\
127 	EM(cachefiles_obj_see_lookup_cookie,	"SEE lookup_cookie")	\
128 	EM(cachefiles_obj_see_lookup_failed,	"SEE lookup_failed")	\
129 	EM(cachefiles_obj_see_withdraw_cookie,	"SEE withdraw_cookie")	\
130 	E_(cachefiles_obj_see_withdrawal,	"SEE withdrawal")
131 
132 #define cachefiles_coherency_traces					\
133 	EM(cachefiles_coherency_check_aux,	"BAD aux ")		\
134 	EM(cachefiles_coherency_check_content,	"BAD cont")		\
135 	EM(cachefiles_coherency_check_dirty,	"BAD dirt")		\
136 	EM(cachefiles_coherency_check_len,	"BAD len ")		\
137 	EM(cachefiles_coherency_check_objsize,	"BAD osiz")		\
138 	EM(cachefiles_coherency_check_ok,	"OK      ")		\
139 	EM(cachefiles_coherency_check_type,	"BAD type")		\
140 	EM(cachefiles_coherency_check_xattr,	"BAD xatt")		\
141 	EM(cachefiles_coherency_set_fail,	"SET fail")		\
142 	EM(cachefiles_coherency_set_ok,		"SET ok  ")		\
143 	EM(cachefiles_coherency_vol_check_cmp,	"VOL BAD cmp ")		\
144 	EM(cachefiles_coherency_vol_check_ok,	"VOL OK      ")		\
145 	EM(cachefiles_coherency_vol_check_resv,	"VOL BAD resv")	\
146 	EM(cachefiles_coherency_vol_check_xattr,"VOL BAD xatt")		\
147 	EM(cachefiles_coherency_vol_set_fail,	"VOL SET fail")		\
148 	E_(cachefiles_coherency_vol_set_ok,	"VOL SET ok  ")
149 
150 #define cachefiles_trunc_traces						\
151 	EM(cachefiles_trunc_dio_adjust,		"DIOADJ")		\
152 	EM(cachefiles_trunc_expand_tmpfile,	"EXPTMP")		\
153 	E_(cachefiles_trunc_shrink,		"SHRINK")
154 
155 #define cachefiles_prepare_read_traces					\
156 	EM(cachefiles_trace_read_after_eof,	"after-eof ")		\
157 	EM(cachefiles_trace_read_found_hole,	"found-hole")		\
158 	EM(cachefiles_trace_read_found_part,	"found-part")		\
159 	EM(cachefiles_trace_read_have_data,	"have-data ")		\
160 	EM(cachefiles_trace_read_no_data,	"no-data   ")		\
161 	EM(cachefiles_trace_read_no_file,	"no-file   ")		\
162 	EM(cachefiles_trace_read_seek_error,	"seek-error")		\
163 	E_(cachefiles_trace_read_seek_nxio,	"seek-enxio")
164 
165 #define cachefiles_error_traces						\
166 	EM(cachefiles_trace_fallocate_error,	"fallocate")		\
167 	EM(cachefiles_trace_getxattr_error,	"getxattr")		\
168 	EM(cachefiles_trace_link_error,		"link")			\
169 	EM(cachefiles_trace_lookup_error,	"lookup")		\
170 	EM(cachefiles_trace_mkdir_error,	"mkdir")		\
171 	EM(cachefiles_trace_notify_change_error, "notify_change")	\
172 	EM(cachefiles_trace_open_error,		"open")			\
173 	EM(cachefiles_trace_read_error,		"read")			\
174 	EM(cachefiles_trace_remxattr_error,	"remxattr")		\
175 	EM(cachefiles_trace_rename_error,	"rename")		\
176 	EM(cachefiles_trace_seek_error,		"seek")			\
177 	EM(cachefiles_trace_setxattr_error,	"setxattr")		\
178 	EM(cachefiles_trace_statfs_error,	"statfs")		\
179 	EM(cachefiles_trace_tmpfile_error,	"tmpfile")		\
180 	EM(cachefiles_trace_trunc_error,	"trunc")		\
181 	EM(cachefiles_trace_unlink_error,	"unlink")		\
182 	E_(cachefiles_trace_write_error,	"write")
183 
184 
185 /*
186  * Export enum symbols via userspace.
187  */
188 #undef EM
189 #undef E_
190 #define EM(a, b) TRACE_DEFINE_ENUM(a);
191 #define E_(a, b) TRACE_DEFINE_ENUM(a);
192 
193 cachefiles_obj_kill_traces;
194 cachefiles_obj_ref_traces;
195 cachefiles_coherency_traces;
196 cachefiles_trunc_traces;
197 cachefiles_prepare_read_traces;
198 cachefiles_error_traces;
199 
200 /*
201  * Now redefine the EM() and E_() macros to map the enums to the strings that
202  * will be printed in the output.
203  */
204 #undef EM
205 #undef E_
206 #define EM(a, b)	{ a, b },
207 #define E_(a, b)	{ a, b }
208 
209 
210 TRACE_EVENT(cachefiles_ref,
211 	    TP_PROTO(unsigned int object_debug_id,
212 		     unsigned int cookie_debug_id,
213 		     int usage,
214 		     enum cachefiles_obj_ref_trace why),
215 
216 	    TP_ARGS(object_debug_id, cookie_debug_id, usage, why),
217 
218 	    /* Note that obj may be NULL */
219 	    TP_STRUCT__entry(
220 		    __field(unsigned int,			obj		)
221 		    __field(unsigned int,			cookie		)
222 		    __field(enum cachefiles_obj_ref_trace,	why		)
223 		    __field(int,				usage		)
224 			     ),
225 
226 	    TP_fast_assign(
227 		    __entry->obj	= object_debug_id;
228 		    __entry->cookie	= cookie_debug_id;
229 		    __entry->usage	= usage;
230 		    __entry->why	= why;
231 			   ),
232 
233 	    TP_printk("c=%08x o=%08x u=%d %s",
234 		      __entry->cookie, __entry->obj, __entry->usage,
235 		      __print_symbolic(__entry->why, cachefiles_obj_ref_traces))
236 	    );
237 
238 TRACE_EVENT(cachefiles_lookup,
239 	    TP_PROTO(struct cachefiles_object *obj,
240 		     struct dentry *dir,
241 		     struct dentry *de),
242 
243 	    TP_ARGS(obj, dir, de),
244 
245 	    TP_STRUCT__entry(
246 		    __field(unsigned int,		obj	)
247 		    __field(short,			error	)
248 		    __field(unsigned long,		dino	)
249 		    __field(unsigned long,		ino	)
250 			     ),
251 
252 	    TP_fast_assign(
253 		    __entry->obj	= obj ? obj->debug_id : 0;
254 		    __entry->dino	= d_backing_inode(dir)->i_ino;
255 		    __entry->ino	= (!IS_ERR(de) && d_backing_inode(de) ?
256 					   d_backing_inode(de)->i_ino : 0);
257 		    __entry->error	= IS_ERR(de) ? PTR_ERR(de) : 0;
258 			   ),
259 
260 	    TP_printk("o=%08x dB=%lx B=%lx e=%d",
261 		      __entry->obj, __entry->dino, __entry->ino, __entry->error)
262 	    );
263 
264 TRACE_EVENT(cachefiles_mkdir,
265 	    TP_PROTO(struct dentry *dir, struct dentry *subdir),
266 
267 	    TP_ARGS(dir, subdir),
268 
269 	    TP_STRUCT__entry(
270 		    __field(unsigned int,			dir	)
271 		    __field(unsigned int,			subdir	)
272 			     ),
273 
274 	    TP_fast_assign(
275 		    __entry->dir	= d_backing_inode(dir)->i_ino;
276 		    __entry->subdir	= d_backing_inode(subdir)->i_ino;
277 			   ),
278 
279 	    TP_printk("dB=%x sB=%x",
280 		      __entry->dir,
281 		      __entry->subdir)
282 	    );
283 
284 TRACE_EVENT(cachefiles_tmpfile,
285 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer),
286 
287 	    TP_ARGS(obj, backer),
288 
289 	    TP_STRUCT__entry(
290 		    __field(unsigned int,			obj	)
291 		    __field(unsigned int,			backer	)
292 			     ),
293 
294 	    TP_fast_assign(
295 		    __entry->obj	= obj->debug_id;
296 		    __entry->backer	= backer->i_ino;
297 			   ),
298 
299 	    TP_printk("o=%08x B=%x",
300 		      __entry->obj,
301 		      __entry->backer)
302 	    );
303 
304 TRACE_EVENT(cachefiles_link,
305 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer),
306 
307 	    TP_ARGS(obj, backer),
308 
309 	    TP_STRUCT__entry(
310 		    __field(unsigned int,			obj	)
311 		    __field(unsigned int,			backer	)
312 			     ),
313 
314 	    TP_fast_assign(
315 		    __entry->obj	= obj->debug_id;
316 		    __entry->backer	= backer->i_ino;
317 			   ),
318 
319 	    TP_printk("o=%08x B=%x",
320 		      __entry->obj,
321 		      __entry->backer)
322 	    );
323 
324 TRACE_EVENT(cachefiles_unlink,
325 	    TP_PROTO(struct cachefiles_object *obj,
326 		     ino_t ino,
327 		     enum fscache_why_object_killed why),
328 
329 	    TP_ARGS(obj, ino, why),
330 
331 	    /* Note that obj may be NULL */
332 	    TP_STRUCT__entry(
333 		    __field(unsigned int,		obj		)
334 		    __field(unsigned int,		ino		)
335 		    __field(enum fscache_why_object_killed, why		)
336 			     ),
337 
338 	    TP_fast_assign(
339 		    __entry->obj	= obj ? obj->debug_id : UINT_MAX;
340 		    __entry->ino	= ino;
341 		    __entry->why	= why;
342 			   ),
343 
344 	    TP_printk("o=%08x B=%x w=%s",
345 		      __entry->obj, __entry->ino,
346 		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
347 	    );
348 
349 TRACE_EVENT(cachefiles_rename,
350 	    TP_PROTO(struct cachefiles_object *obj,
351 		     ino_t ino,
352 		     enum fscache_why_object_killed why),
353 
354 	    TP_ARGS(obj, ino, why),
355 
356 	    /* Note that obj may be NULL */
357 	    TP_STRUCT__entry(
358 		    __field(unsigned int,		obj		)
359 		    __field(unsigned int,		ino		)
360 		    __field(enum fscache_why_object_killed, why		)
361 			     ),
362 
363 	    TP_fast_assign(
364 		    __entry->obj	= obj ? obj->debug_id : UINT_MAX;
365 		    __entry->ino	= ino;
366 		    __entry->why	= why;
367 			   ),
368 
369 	    TP_printk("o=%08x B=%x w=%s",
370 		      __entry->obj, __entry->ino,
371 		      __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
372 	    );
373 
374 TRACE_EVENT(cachefiles_coherency,
375 	    TP_PROTO(struct cachefiles_object *obj,
376 		     ino_t ino,
377 		     enum cachefiles_content content,
378 		     enum cachefiles_coherency_trace why),
379 
380 	    TP_ARGS(obj, ino, content, why),
381 
382 	    /* Note that obj may be NULL */
383 	    TP_STRUCT__entry(
384 		    __field(unsigned int,			obj	)
385 		    __field(enum cachefiles_coherency_trace,	why	)
386 		    __field(enum cachefiles_content,		content	)
387 		    __field(u64,				ino	)
388 			     ),
389 
390 	    TP_fast_assign(
391 		    __entry->obj	= obj->debug_id;
392 		    __entry->why	= why;
393 		    __entry->content	= content;
394 		    __entry->ino	= ino;
395 			   ),
396 
397 	    TP_printk("o=%08x %s B=%llx c=%u",
398 		      __entry->obj,
399 		      __print_symbolic(__entry->why, cachefiles_coherency_traces),
400 		      __entry->ino,
401 		      __entry->content)
402 	    );
403 
404 TRACE_EVENT(cachefiles_vol_coherency,
405 	    TP_PROTO(struct cachefiles_volume *volume,
406 		     ino_t ino,
407 		     enum cachefiles_coherency_trace why),
408 
409 	    TP_ARGS(volume, ino, why),
410 
411 	    /* Note that obj may be NULL */
412 	    TP_STRUCT__entry(
413 		    __field(unsigned int,			vol	)
414 		    __field(enum cachefiles_coherency_trace,	why	)
415 		    __field(u64,				ino	)
416 			     ),
417 
418 	    TP_fast_assign(
419 		    __entry->vol	= volume->vcookie->debug_id;
420 		    __entry->why	= why;
421 		    __entry->ino	= ino;
422 			   ),
423 
424 	    TP_printk("V=%08x %s B=%llx",
425 		      __entry->vol,
426 		      __print_symbolic(__entry->why, cachefiles_coherency_traces),
427 		      __entry->ino)
428 	    );
429 
430 TRACE_EVENT(cachefiles_prep_read,
431 	    TP_PROTO(struct cachefiles_object *obj,
432 		     loff_t start,
433 		     size_t len,
434 		     unsigned short flags,
435 		     enum netfs_io_source source,
436 		     enum cachefiles_prepare_read_trace why,
437 		     ino_t cache_inode, ino_t netfs_inode),
438 
439 	    TP_ARGS(obj, start, len, flags, source, why, cache_inode, netfs_inode),
440 
441 	    TP_STRUCT__entry(
442 		    __field(unsigned int,		obj		)
443 		    __field(unsigned short,		flags		)
444 		    __field(enum netfs_io_source,	source		)
445 		    __field(enum cachefiles_prepare_read_trace,	why	)
446 		    __field(size_t,			len		)
447 		    __field(loff_t,			start		)
448 		    __field(unsigned int,		netfs_inode	)
449 		    __field(unsigned int,		cache_inode	)
450 			     ),
451 
452 	    TP_fast_assign(
453 		    __entry->obj	= obj ? obj->debug_id : 0;
454 		    __entry->flags	= flags;
455 		    __entry->source	= source;
456 		    __entry->why	= why;
457 		    __entry->len	= len;
458 		    __entry->start	= start;
459 		    __entry->netfs_inode = netfs_inode;
460 		    __entry->cache_inode = cache_inode;
461 			   ),
462 
463 	    TP_printk("o=%08x %s %s f=%02x s=%llx %zx ni=%x B=%x",
464 		      __entry->obj,
465 		      __print_symbolic(__entry->source, netfs_sreq_sources),
466 		      __print_symbolic(__entry->why, cachefiles_prepare_read_traces),
467 		      __entry->flags,
468 		      __entry->start, __entry->len,
469 		      __entry->netfs_inode, __entry->cache_inode)
470 	    );
471 
472 TRACE_EVENT(cachefiles_read,
473 	    TP_PROTO(struct cachefiles_object *obj,
474 		     struct inode *backer,
475 		     loff_t start,
476 		     size_t len),
477 
478 	    TP_ARGS(obj, backer, start, len),
479 
480 	    TP_STRUCT__entry(
481 		    __field(unsigned int,			obj	)
482 		    __field(unsigned int,			backer	)
483 		    __field(size_t,				len	)
484 		    __field(loff_t,				start	)
485 			     ),
486 
487 	    TP_fast_assign(
488 		    __entry->obj	= obj->debug_id;
489 		    __entry->backer	= backer->i_ino;
490 		    __entry->start	= start;
491 		    __entry->len	= len;
492 			   ),
493 
494 	    TP_printk("o=%08x B=%x s=%llx l=%zx",
495 		      __entry->obj,
496 		      __entry->backer,
497 		      __entry->start,
498 		      __entry->len)
499 	    );
500 
501 TRACE_EVENT(cachefiles_write,
502 	    TP_PROTO(struct cachefiles_object *obj,
503 		     struct inode *backer,
504 		     loff_t start,
505 		     size_t len),
506 
507 	    TP_ARGS(obj, backer, start, len),
508 
509 	    TP_STRUCT__entry(
510 		    __field(unsigned int,			obj	)
511 		    __field(unsigned int,			backer	)
512 		    __field(size_t,				len	)
513 		    __field(loff_t,				start	)
514 			     ),
515 
516 	    TP_fast_assign(
517 		    __entry->obj	= obj->debug_id;
518 		    __entry->backer	= backer->i_ino;
519 		    __entry->start	= start;
520 		    __entry->len	= len;
521 			   ),
522 
523 	    TP_printk("o=%08x B=%x s=%llx l=%zx",
524 		      __entry->obj,
525 		      __entry->backer,
526 		      __entry->start,
527 		      __entry->len)
528 	    );
529 
530 TRACE_EVENT(cachefiles_trunc,
531 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
532 		     loff_t from, loff_t to, enum cachefiles_trunc_trace why),
533 
534 	    TP_ARGS(obj, backer, from, to, why),
535 
536 	    TP_STRUCT__entry(
537 		    __field(unsigned int,			obj	)
538 		    __field(unsigned int,			backer	)
539 		    __field(enum cachefiles_trunc_trace,	why	)
540 		    __field(loff_t,				from	)
541 		    __field(loff_t,				to	)
542 			     ),
543 
544 	    TP_fast_assign(
545 		    __entry->obj	= obj->debug_id;
546 		    __entry->backer	= backer->i_ino;
547 		    __entry->from	= from;
548 		    __entry->to		= to;
549 		    __entry->why	= why;
550 			   ),
551 
552 	    TP_printk("o=%08x B=%x %s l=%llx->%llx",
553 		      __entry->obj,
554 		      __entry->backer,
555 		      __print_symbolic(__entry->why, cachefiles_trunc_traces),
556 		      __entry->from,
557 		      __entry->to)
558 	    );
559 
560 TRACE_EVENT(cachefiles_mark_active,
561 	    TP_PROTO(struct cachefiles_object *obj,
562 		     struct inode *inode),
563 
564 	    TP_ARGS(obj, inode),
565 
566 	    /* Note that obj may be NULL */
567 	    TP_STRUCT__entry(
568 		    __field(unsigned int,		obj		)
569 		    __field(ino_t,			inode		)
570 			     ),
571 
572 	    TP_fast_assign(
573 		    __entry->obj	= obj ? obj->debug_id : 0;
574 		    __entry->inode	= inode->i_ino;
575 			   ),
576 
577 	    TP_printk("o=%08x B=%lx",
578 		      __entry->obj, __entry->inode)
579 	    );
580 
581 TRACE_EVENT(cachefiles_mark_failed,
582 	    TP_PROTO(struct cachefiles_object *obj,
583 		     struct inode *inode),
584 
585 	    TP_ARGS(obj, inode),
586 
587 	    /* Note that obj may be NULL */
588 	    TP_STRUCT__entry(
589 		    __field(unsigned int,		obj		)
590 		    __field(ino_t,			inode		)
591 			     ),
592 
593 	    TP_fast_assign(
594 		    __entry->obj	= obj ? obj->debug_id : 0;
595 		    __entry->inode	= inode->i_ino;
596 			   ),
597 
598 	    TP_printk("o=%08x B=%lx",
599 		      __entry->obj, __entry->inode)
600 	    );
601 
602 TRACE_EVENT(cachefiles_mark_inactive,
603 	    TP_PROTO(struct cachefiles_object *obj,
604 		     struct inode *inode),
605 
606 	    TP_ARGS(obj, inode),
607 
608 	    /* Note that obj may be NULL */
609 	    TP_STRUCT__entry(
610 		    __field(unsigned int,		obj		)
611 		    __field(ino_t,			inode		)
612 			     ),
613 
614 	    TP_fast_assign(
615 		    __entry->obj	= obj ? obj->debug_id : 0;
616 		    __entry->inode	= inode->i_ino;
617 			   ),
618 
619 	    TP_printk("o=%08x B=%lx",
620 		      __entry->obj, __entry->inode)
621 	    );
622 
623 TRACE_EVENT(cachefiles_vfs_error,
624 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
625 		     int error, enum cachefiles_error_trace where),
626 
627 	    TP_ARGS(obj, backer, error, where),
628 
629 	    TP_STRUCT__entry(
630 		    __field(unsigned int,			obj	)
631 		    __field(unsigned int,			backer	)
632 		    __field(enum cachefiles_error_trace,	where	)
633 		    __field(short,				error	)
634 			     ),
635 
636 	    TP_fast_assign(
637 		    __entry->obj	= obj ? obj->debug_id : 0;
638 		    __entry->backer	= backer->i_ino;
639 		    __entry->error	= error;
640 		    __entry->where	= where;
641 			   ),
642 
643 	    TP_printk("o=%08x B=%x %s e=%d",
644 		      __entry->obj,
645 		      __entry->backer,
646 		      __print_symbolic(__entry->where, cachefiles_error_traces),
647 		      __entry->error)
648 	    );
649 
650 TRACE_EVENT(cachefiles_io_error,
651 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
652 		     int error, enum cachefiles_error_trace where),
653 
654 	    TP_ARGS(obj, backer, error, where),
655 
656 	    TP_STRUCT__entry(
657 		    __field(unsigned int,			obj	)
658 		    __field(unsigned int,			backer	)
659 		    __field(enum cachefiles_error_trace,	where	)
660 		    __field(short,				error	)
661 			     ),
662 
663 	    TP_fast_assign(
664 		    __entry->obj	= obj ? obj->debug_id : 0;
665 		    __entry->backer	= backer->i_ino;
666 		    __entry->error	= error;
667 		    __entry->where	= where;
668 			   ),
669 
670 	    TP_printk("o=%08x B=%x %s e=%d",
671 		      __entry->obj,
672 		      __entry->backer,
673 		      __print_symbolic(__entry->where, cachefiles_error_traces),
674 		      __entry->error)
675 	    );
676 
677 TRACE_EVENT(cachefiles_ondemand_open,
678 	    TP_PROTO(struct cachefiles_object *obj, struct cachefiles_msg *msg,
679 		     struct cachefiles_open *load),
680 
681 	    TP_ARGS(obj, msg, load),
682 
683 	    TP_STRUCT__entry(
684 		    __field(unsigned int,	obj		)
685 		    __field(unsigned int,	msg_id		)
686 		    __field(unsigned int,	object_id	)
687 		    __field(unsigned int,	fd		)
688 		    __field(unsigned int,	flags		)
689 			     ),
690 
691 	    TP_fast_assign(
692 		    __entry->obj	= obj ? obj->debug_id : 0;
693 		    __entry->msg_id	= msg->msg_id;
694 		    __entry->object_id	= msg->object_id;
695 		    __entry->fd		= load->fd;
696 		    __entry->flags	= load->flags;
697 			   ),
698 
699 	    TP_printk("o=%08x mid=%x oid=%x fd=%d f=%x",
700 		      __entry->obj,
701 		      __entry->msg_id,
702 		      __entry->object_id,
703 		      __entry->fd,
704 		      __entry->flags)
705 	    );
706 
707 TRACE_EVENT(cachefiles_ondemand_copen,
708 	    TP_PROTO(struct cachefiles_object *obj, unsigned int msg_id,
709 		     long len),
710 
711 	    TP_ARGS(obj, msg_id, len),
712 
713 	    TP_STRUCT__entry(
714 		    __field(unsigned int,	obj	)
715 		    __field(unsigned int,	msg_id	)
716 		    __field(long,		len	)
717 			     ),
718 
719 	    TP_fast_assign(
720 		    __entry->obj	= obj ? obj->debug_id : 0;
721 		    __entry->msg_id	= msg_id;
722 		    __entry->len	= len;
723 			   ),
724 
725 	    TP_printk("o=%08x mid=%x l=%lx",
726 		      __entry->obj,
727 		      __entry->msg_id,
728 		      __entry->len)
729 	    );
730 
731 TRACE_EVENT(cachefiles_ondemand_close,
732 	    TP_PROTO(struct cachefiles_object *obj, struct cachefiles_msg *msg),
733 
734 	    TP_ARGS(obj, msg),
735 
736 	    TP_STRUCT__entry(
737 		    __field(unsigned int,	obj		)
738 		    __field(unsigned int,	msg_id		)
739 		    __field(unsigned int,	object_id	)
740 			     ),
741 
742 	    TP_fast_assign(
743 		    __entry->obj	= obj ? obj->debug_id : 0;
744 		    __entry->msg_id	= msg->msg_id;
745 		    __entry->object_id	= msg->object_id;
746 			   ),
747 
748 	    TP_printk("o=%08x mid=%x oid=%x",
749 		      __entry->obj,
750 		      __entry->msg_id,
751 		      __entry->object_id)
752 	    );
753 
754 TRACE_EVENT(cachefiles_ondemand_read,
755 	    TP_PROTO(struct cachefiles_object *obj, struct cachefiles_msg *msg,
756 		     struct cachefiles_read *load),
757 
758 	    TP_ARGS(obj, msg, load),
759 
760 	    TP_STRUCT__entry(
761 		    __field(unsigned int,	obj		)
762 		    __field(unsigned int,	msg_id		)
763 		    __field(unsigned int,	object_id	)
764 		    __field(loff_t,		start		)
765 		    __field(size_t,		len		)
766 			     ),
767 
768 	    TP_fast_assign(
769 		    __entry->obj	= obj ? obj->debug_id : 0;
770 		    __entry->msg_id	= msg->msg_id;
771 		    __entry->object_id	= msg->object_id;
772 		    __entry->start	= load->off;
773 		    __entry->len	= load->len;
774 			   ),
775 
776 	    TP_printk("o=%08x mid=%x oid=%x s=%llx l=%zx",
777 		      __entry->obj,
778 		      __entry->msg_id,
779 		      __entry->object_id,
780 		      __entry->start,
781 		      __entry->len)
782 	    );
783 
784 TRACE_EVENT(cachefiles_ondemand_cread,
785 	    TP_PROTO(struct cachefiles_object *obj, unsigned int msg_id),
786 
787 	    TP_ARGS(obj, msg_id),
788 
789 	    TP_STRUCT__entry(
790 		    __field(unsigned int,	obj	)
791 		    __field(unsigned int,	msg_id	)
792 			     ),
793 
794 	    TP_fast_assign(
795 		    __entry->obj	= obj ? obj->debug_id : 0;
796 		    __entry->msg_id	= msg_id;
797 			   ),
798 
799 	    TP_printk("o=%08x mid=%x",
800 		      __entry->obj,
801 		      __entry->msg_id)
802 	    );
803 
804 TRACE_EVENT(cachefiles_ondemand_fd_write,
805 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
806 		     loff_t start, size_t len),
807 
808 	    TP_ARGS(obj, backer, start, len),
809 
810 	    TP_STRUCT__entry(
811 		    __field(unsigned int,	obj	)
812 		    __field(unsigned int,	backer	)
813 		    __field(loff_t,		start	)
814 		    __field(size_t,		len	)
815 			     ),
816 
817 	    TP_fast_assign(
818 		    __entry->obj	= obj ? obj->debug_id : 0;
819 		    __entry->backer	= backer->i_ino;
820 		    __entry->start	= start;
821 		    __entry->len	= len;
822 			   ),
823 
824 	    TP_printk("o=%08x iB=%x s=%llx l=%zx",
825 		      __entry->obj,
826 		      __entry->backer,
827 		      __entry->start,
828 		      __entry->len)
829 	    );
830 
831 TRACE_EVENT(cachefiles_ondemand_fd_release,
832 	    TP_PROTO(struct cachefiles_object *obj, int object_id),
833 
834 	    TP_ARGS(obj, object_id),
835 
836 	    TP_STRUCT__entry(
837 		    __field(unsigned int,	obj		)
838 		    __field(unsigned int,	object_id	)
839 			     ),
840 
841 	    TP_fast_assign(
842 		    __entry->obj	= obj ? obj->debug_id : 0;
843 		    __entry->object_id	= object_id;
844 			   ),
845 
846 	    TP_printk("o=%08x oid=%x",
847 		      __entry->obj,
848 		      __entry->object_id)
849 	    );
850 
851 #endif /* _TRACE_CACHEFILES_H */
852 
853 /* This part must be outside protection */
854 #include <trace/define_trace.h>
855