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