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 netfs_io_subrequest *sreq,
432 		     enum netfs_io_source source,
433 		     enum cachefiles_prepare_read_trace why,
434 		     ino_t cache_inode),
435 
436 	    TP_ARGS(sreq, source, why, cache_inode),
437 
438 	    TP_STRUCT__entry(
439 		    __field(unsigned int,		rreq		)
440 		    __field(unsigned short,		index		)
441 		    __field(unsigned short,		flags		)
442 		    __field(enum netfs_io_source,	source		)
443 		    __field(enum cachefiles_prepare_read_trace,	why	)
444 		    __field(size_t,			len		)
445 		    __field(loff_t,			start		)
446 		    __field(unsigned int,		netfs_inode	)
447 		    __field(unsigned int,		cache_inode	)
448 			     ),
449 
450 	    TP_fast_assign(
451 		    __entry->rreq	= sreq->rreq->debug_id;
452 		    __entry->index	= sreq->debug_index;
453 		    __entry->flags	= sreq->flags;
454 		    __entry->source	= source;
455 		    __entry->why	= why;
456 		    __entry->len	= sreq->len;
457 		    __entry->start	= sreq->start;
458 		    __entry->netfs_inode = sreq->rreq->inode->i_ino;
459 		    __entry->cache_inode = cache_inode;
460 			   ),
461 
462 	    TP_printk("R=%08x[%u] %s %s f=%02x s=%llx %zx ni=%x B=%x",
463 		      __entry->rreq, __entry->index,
464 		      __print_symbolic(__entry->source, netfs_sreq_sources),
465 		      __print_symbolic(__entry->why, cachefiles_prepare_read_traces),
466 		      __entry->flags,
467 		      __entry->start, __entry->len,
468 		      __entry->netfs_inode, __entry->cache_inode)
469 	    );
470 
471 TRACE_EVENT(cachefiles_read,
472 	    TP_PROTO(struct cachefiles_object *obj,
473 		     struct inode *backer,
474 		     loff_t start,
475 		     size_t len),
476 
477 	    TP_ARGS(obj, backer, start, len),
478 
479 	    TP_STRUCT__entry(
480 		    __field(unsigned int,			obj	)
481 		    __field(unsigned int,			backer	)
482 		    __field(size_t,				len	)
483 		    __field(loff_t,				start	)
484 			     ),
485 
486 	    TP_fast_assign(
487 		    __entry->obj	= obj->debug_id;
488 		    __entry->backer	= backer->i_ino;
489 		    __entry->start	= start;
490 		    __entry->len	= len;
491 			   ),
492 
493 	    TP_printk("o=%08x B=%x s=%llx l=%zx",
494 		      __entry->obj,
495 		      __entry->backer,
496 		      __entry->start,
497 		      __entry->len)
498 	    );
499 
500 TRACE_EVENT(cachefiles_write,
501 	    TP_PROTO(struct cachefiles_object *obj,
502 		     struct inode *backer,
503 		     loff_t start,
504 		     size_t len),
505 
506 	    TP_ARGS(obj, backer, start, len),
507 
508 	    TP_STRUCT__entry(
509 		    __field(unsigned int,			obj	)
510 		    __field(unsigned int,			backer	)
511 		    __field(size_t,				len	)
512 		    __field(loff_t,				start	)
513 			     ),
514 
515 	    TP_fast_assign(
516 		    __entry->obj	= obj->debug_id;
517 		    __entry->backer	= backer->i_ino;
518 		    __entry->start	= start;
519 		    __entry->len	= len;
520 			   ),
521 
522 	    TP_printk("o=%08x B=%x s=%llx l=%zx",
523 		      __entry->obj,
524 		      __entry->backer,
525 		      __entry->start,
526 		      __entry->len)
527 	    );
528 
529 TRACE_EVENT(cachefiles_trunc,
530 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
531 		     loff_t from, loff_t to, enum cachefiles_trunc_trace why),
532 
533 	    TP_ARGS(obj, backer, from, to, why),
534 
535 	    TP_STRUCT__entry(
536 		    __field(unsigned int,			obj	)
537 		    __field(unsigned int,			backer	)
538 		    __field(enum cachefiles_trunc_trace,	why	)
539 		    __field(loff_t,				from	)
540 		    __field(loff_t,				to	)
541 			     ),
542 
543 	    TP_fast_assign(
544 		    __entry->obj	= obj->debug_id;
545 		    __entry->backer	= backer->i_ino;
546 		    __entry->from	= from;
547 		    __entry->to		= to;
548 		    __entry->why	= why;
549 			   ),
550 
551 	    TP_printk("o=%08x B=%x %s l=%llx->%llx",
552 		      __entry->obj,
553 		      __entry->backer,
554 		      __print_symbolic(__entry->why, cachefiles_trunc_traces),
555 		      __entry->from,
556 		      __entry->to)
557 	    );
558 
559 TRACE_EVENT(cachefiles_mark_active,
560 	    TP_PROTO(struct cachefiles_object *obj,
561 		     struct inode *inode),
562 
563 	    TP_ARGS(obj, inode),
564 
565 	    /* Note that obj may be NULL */
566 	    TP_STRUCT__entry(
567 		    __field(unsigned int,		obj		)
568 		    __field(ino_t,			inode		)
569 			     ),
570 
571 	    TP_fast_assign(
572 		    __entry->obj	= obj ? obj->debug_id : 0;
573 		    __entry->inode	= inode->i_ino;
574 			   ),
575 
576 	    TP_printk("o=%08x B=%lx",
577 		      __entry->obj, __entry->inode)
578 	    );
579 
580 TRACE_EVENT(cachefiles_mark_failed,
581 	    TP_PROTO(struct cachefiles_object *obj,
582 		     struct inode *inode),
583 
584 	    TP_ARGS(obj, inode),
585 
586 	    /* Note that obj may be NULL */
587 	    TP_STRUCT__entry(
588 		    __field(unsigned int,		obj		)
589 		    __field(ino_t,			inode		)
590 			     ),
591 
592 	    TP_fast_assign(
593 		    __entry->obj	= obj ? obj->debug_id : 0;
594 		    __entry->inode	= inode->i_ino;
595 			   ),
596 
597 	    TP_printk("o=%08x B=%lx",
598 		      __entry->obj, __entry->inode)
599 	    );
600 
601 TRACE_EVENT(cachefiles_mark_inactive,
602 	    TP_PROTO(struct cachefiles_object *obj,
603 		     struct inode *inode),
604 
605 	    TP_ARGS(obj, inode),
606 
607 	    /* Note that obj may be NULL */
608 	    TP_STRUCT__entry(
609 		    __field(unsigned int,		obj		)
610 		    __field(ino_t,			inode		)
611 			     ),
612 
613 	    TP_fast_assign(
614 		    __entry->obj	= obj ? obj->debug_id : 0;
615 		    __entry->inode	= inode->i_ino;
616 			   ),
617 
618 	    TP_printk("o=%08x B=%lx",
619 		      __entry->obj, __entry->inode)
620 	    );
621 
622 TRACE_EVENT(cachefiles_vfs_error,
623 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
624 		     int error, enum cachefiles_error_trace where),
625 
626 	    TP_ARGS(obj, backer, error, where),
627 
628 	    TP_STRUCT__entry(
629 		    __field(unsigned int,			obj	)
630 		    __field(unsigned int,			backer	)
631 		    __field(enum cachefiles_error_trace,	where	)
632 		    __field(short,				error	)
633 			     ),
634 
635 	    TP_fast_assign(
636 		    __entry->obj	= obj ? obj->debug_id : 0;
637 		    __entry->backer	= backer->i_ino;
638 		    __entry->error	= error;
639 		    __entry->where	= where;
640 			   ),
641 
642 	    TP_printk("o=%08x B=%x %s e=%d",
643 		      __entry->obj,
644 		      __entry->backer,
645 		      __print_symbolic(__entry->where, cachefiles_error_traces),
646 		      __entry->error)
647 	    );
648 
649 TRACE_EVENT(cachefiles_io_error,
650 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
651 		     int error, enum cachefiles_error_trace where),
652 
653 	    TP_ARGS(obj, backer, error, where),
654 
655 	    TP_STRUCT__entry(
656 		    __field(unsigned int,			obj	)
657 		    __field(unsigned int,			backer	)
658 		    __field(enum cachefiles_error_trace,	where	)
659 		    __field(short,				error	)
660 			     ),
661 
662 	    TP_fast_assign(
663 		    __entry->obj	= obj ? obj->debug_id : 0;
664 		    __entry->backer	= backer->i_ino;
665 		    __entry->error	= error;
666 		    __entry->where	= where;
667 			   ),
668 
669 	    TP_printk("o=%08x B=%x %s e=%d",
670 		      __entry->obj,
671 		      __entry->backer,
672 		      __print_symbolic(__entry->where, cachefiles_error_traces),
673 		      __entry->error)
674 	    );
675 
676 TRACE_EVENT(cachefiles_ondemand_open,
677 	    TP_PROTO(struct cachefiles_object *obj, struct cachefiles_msg *msg,
678 		     struct cachefiles_open *load),
679 
680 	    TP_ARGS(obj, msg, load),
681 
682 	    TP_STRUCT__entry(
683 		    __field(unsigned int,	obj		)
684 		    __field(unsigned int,	msg_id		)
685 		    __field(unsigned int,	object_id	)
686 		    __field(unsigned int,	fd		)
687 		    __field(unsigned int,	flags		)
688 			     ),
689 
690 	    TP_fast_assign(
691 		    __entry->obj	= obj ? obj->debug_id : 0;
692 		    __entry->msg_id	= msg->msg_id;
693 		    __entry->object_id	= msg->object_id;
694 		    __entry->fd		= load->fd;
695 		    __entry->flags	= load->flags;
696 			   ),
697 
698 	    TP_printk("o=%08x mid=%x oid=%x fd=%d f=%x",
699 		      __entry->obj,
700 		      __entry->msg_id,
701 		      __entry->object_id,
702 		      __entry->fd,
703 		      __entry->flags)
704 	    );
705 
706 TRACE_EVENT(cachefiles_ondemand_copen,
707 	    TP_PROTO(struct cachefiles_object *obj, unsigned int msg_id,
708 		     long len),
709 
710 	    TP_ARGS(obj, msg_id, len),
711 
712 	    TP_STRUCT__entry(
713 		    __field(unsigned int,	obj	)
714 		    __field(unsigned int,	msg_id	)
715 		    __field(long,		len	)
716 			     ),
717 
718 	    TP_fast_assign(
719 		    __entry->obj	= obj ? obj->debug_id : 0;
720 		    __entry->msg_id	= msg_id;
721 		    __entry->len	= len;
722 			   ),
723 
724 	    TP_printk("o=%08x mid=%x l=%lx",
725 		      __entry->obj,
726 		      __entry->msg_id,
727 		      __entry->len)
728 	    );
729 
730 TRACE_EVENT(cachefiles_ondemand_close,
731 	    TP_PROTO(struct cachefiles_object *obj, struct cachefiles_msg *msg),
732 
733 	    TP_ARGS(obj, msg),
734 
735 	    TP_STRUCT__entry(
736 		    __field(unsigned int,	obj		)
737 		    __field(unsigned int,	msg_id		)
738 		    __field(unsigned int,	object_id	)
739 			     ),
740 
741 	    TP_fast_assign(
742 		    __entry->obj	= obj ? obj->debug_id : 0;
743 		    __entry->msg_id	= msg->msg_id;
744 		    __entry->object_id	= msg->object_id;
745 			   ),
746 
747 	    TP_printk("o=%08x mid=%x oid=%x",
748 		      __entry->obj,
749 		      __entry->msg_id,
750 		      __entry->object_id)
751 	    );
752 
753 TRACE_EVENT(cachefiles_ondemand_read,
754 	    TP_PROTO(struct cachefiles_object *obj, struct cachefiles_msg *msg,
755 		     struct cachefiles_read *load),
756 
757 	    TP_ARGS(obj, msg, load),
758 
759 	    TP_STRUCT__entry(
760 		    __field(unsigned int,	obj		)
761 		    __field(unsigned int,	msg_id		)
762 		    __field(unsigned int,	object_id	)
763 		    __field(loff_t,		start		)
764 		    __field(size_t,		len		)
765 			     ),
766 
767 	    TP_fast_assign(
768 		    __entry->obj	= obj ? obj->debug_id : 0;
769 		    __entry->msg_id	= msg->msg_id;
770 		    __entry->object_id	= msg->object_id;
771 		    __entry->start	= load->off;
772 		    __entry->len	= load->len;
773 			   ),
774 
775 	    TP_printk("o=%08x mid=%x oid=%x s=%llx l=%zx",
776 		      __entry->obj,
777 		      __entry->msg_id,
778 		      __entry->object_id,
779 		      __entry->start,
780 		      __entry->len)
781 	    );
782 
783 TRACE_EVENT(cachefiles_ondemand_cread,
784 	    TP_PROTO(struct cachefiles_object *obj, unsigned int msg_id),
785 
786 	    TP_ARGS(obj, msg_id),
787 
788 	    TP_STRUCT__entry(
789 		    __field(unsigned int,	obj	)
790 		    __field(unsigned int,	msg_id	)
791 			     ),
792 
793 	    TP_fast_assign(
794 		    __entry->obj	= obj ? obj->debug_id : 0;
795 		    __entry->msg_id	= msg_id;
796 			   ),
797 
798 	    TP_printk("o=%08x mid=%x",
799 		      __entry->obj,
800 		      __entry->msg_id)
801 	    );
802 
803 TRACE_EVENT(cachefiles_ondemand_fd_write,
804 	    TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
805 		     loff_t start, size_t len),
806 
807 	    TP_ARGS(obj, backer, start, len),
808 
809 	    TP_STRUCT__entry(
810 		    __field(unsigned int,	obj	)
811 		    __field(unsigned int,	backer	)
812 		    __field(loff_t,		start	)
813 		    __field(size_t,		len	)
814 			     ),
815 
816 	    TP_fast_assign(
817 		    __entry->obj	= obj ? obj->debug_id : 0;
818 		    __entry->backer	= backer->i_ino;
819 		    __entry->start	= start;
820 		    __entry->len	= len;
821 			   ),
822 
823 	    TP_printk("o=%08x iB=%x s=%llx l=%zx",
824 		      __entry->obj,
825 		      __entry->backer,
826 		      __entry->start,
827 		      __entry->len)
828 	    );
829 
830 TRACE_EVENT(cachefiles_ondemand_fd_release,
831 	    TP_PROTO(struct cachefiles_object *obj, int object_id),
832 
833 	    TP_ARGS(obj, object_id),
834 
835 	    TP_STRUCT__entry(
836 		    __field(unsigned int,	obj		)
837 		    __field(unsigned int,	object_id	)
838 			     ),
839 
840 	    TP_fast_assign(
841 		    __entry->obj	= obj ? obj->debug_id : 0;
842 		    __entry->object_id	= object_id;
843 			   ),
844 
845 	    TP_printk("o=%08x oid=%x",
846 		      __entry->obj,
847 		      __entry->object_id)
848 	    );
849 
850 #endif /* _TRACE_CACHEFILES_H */
851 
852 /* This part must be outside protection */
853 #include <trace/define_trace.h>
854