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