1 /* CacheFiles tracepoints
3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
12 #define TRACE_SYSTEM cachefiles
14 #if !defined(_TRACE_CACHEFILES_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define _TRACE_CACHEFILES_H
17 #include <linux/tracepoint.h>
20 * Define enums for tracing information.
22 #ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
23 #define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
25 enum cachefiles_obj_ref_trace
{
26 cachefiles_obj_put_wait_retry
= fscache_obj_ref__nr_traces
,
27 cachefiles_obj_put_wait_timeo
,
28 cachefiles_obj_ref__nr_traces
34 * Define enum -> string mappings for display.
36 #define cachefiles_obj_kill_traces \
37 EM(FSCACHE_OBJECT_IS_STALE, "stale") \
38 EM(FSCACHE_OBJECT_NO_SPACE, "no_space") \
39 EM(FSCACHE_OBJECT_WAS_RETIRED, "was_retired") \
40 E_(FSCACHE_OBJECT_WAS_CULLED, "was_culled")
42 #define cachefiles_obj_ref_traces \
43 EM(fscache_obj_get_add_to_deps, "GET add_to_deps") \
44 EM(fscache_obj_get_queue, "GET queue") \
45 EM(fscache_obj_put_alloc_fail, "PUT alloc_fail") \
46 EM(fscache_obj_put_attach_fail, "PUT attach_fail") \
47 EM(fscache_obj_put_drop_obj, "PUT drop_obj") \
48 EM(fscache_obj_put_enq_dep, "PUT enq_dep") \
49 EM(fscache_obj_put_queue, "PUT queue") \
50 EM(fscache_obj_put_work, "PUT work") \
51 EM(cachefiles_obj_put_wait_retry, "PUT wait_retry") \
52 E_(cachefiles_obj_put_wait_timeo, "PUT wait_timeo")
55 * Export enum symbols via userspace.
59 #define EM(a, b) TRACE_DEFINE_ENUM(a);
60 #define E_(a, b) TRACE_DEFINE_ENUM(a);
62 cachefiles_obj_kill_traces
;
63 cachefiles_obj_ref_traces
;
66 * Now redefine the EM() and E_() macros to map the enums to the strings that
67 * will be printed in the output.
71 #define EM(a, b) { a, b },
72 #define E_(a, b) { a, b }
75 TRACE_EVENT(cachefiles_ref
,
76 TP_PROTO(struct cachefiles_object
*obj
,
77 struct fscache_cookie
*cookie
,
78 enum cachefiles_obj_ref_trace why
,
81 TP_ARGS(obj
, cookie
, why
, usage
),
83 /* Note that obj may be NULL */
85 __field(struct cachefiles_object
*, obj
)
86 __field(struct fscache_cookie
*, cookie
)
87 __field(enum cachefiles_obj_ref_trace
, why
)
93 __entry
->cookie
= cookie
;
94 __entry
->usage
= usage
;
98 TP_printk("c=%p o=%p u=%d %s",
99 __entry
->cookie
, __entry
->obj
, __entry
->usage
,
100 __print_symbolic(__entry
->why
, cachefiles_obj_ref_traces
))
103 TRACE_EVENT(cachefiles_lookup
,
104 TP_PROTO(struct cachefiles_object
*obj
,
106 struct inode
*inode
),
108 TP_ARGS(obj
, de
, inode
),
111 __field(struct cachefiles_object
*, obj
)
112 __field(struct dentry
*, de
)
113 __field(struct inode
*, inode
)
119 __entry
->inode
= inode
;
122 TP_printk("o=%p d=%p i=%p",
123 __entry
->obj
, __entry
->de
, __entry
->inode
)
126 TRACE_EVENT(cachefiles_mkdir
,
127 TP_PROTO(struct cachefiles_object
*obj
,
128 struct dentry
*de
, int ret
),
130 TP_ARGS(obj
, de
, ret
),
133 __field(struct cachefiles_object
*, obj
)
134 __field(struct dentry
*, de
)
144 TP_printk("o=%p d=%p r=%u",
145 __entry
->obj
, __entry
->de
, __entry
->ret
)
148 TRACE_EVENT(cachefiles_create
,
149 TP_PROTO(struct cachefiles_object
*obj
,
150 struct dentry
*de
, int ret
),
152 TP_ARGS(obj
, de
, ret
),
155 __field(struct cachefiles_object
*, obj
)
156 __field(struct dentry
*, de
)
166 TP_printk("o=%p d=%p r=%u",
167 __entry
->obj
, __entry
->de
, __entry
->ret
)
170 TRACE_EVENT(cachefiles_unlink
,
171 TP_PROTO(struct cachefiles_object
*obj
,
173 enum fscache_why_object_killed why
),
175 TP_ARGS(obj
, de
, why
),
177 /* Note that obj may be NULL */
179 __field(struct cachefiles_object
*, obj
)
180 __field(struct dentry
*, de
)
181 __field(enum fscache_why_object_killed
, why
)
190 TP_printk("o=%p d=%p w=%s",
191 __entry
->obj
, __entry
->de
,
192 __print_symbolic(__entry
->why
, cachefiles_obj_kill_traces
))
195 TRACE_EVENT(cachefiles_rename
,
196 TP_PROTO(struct cachefiles_object
*obj
,
199 enum fscache_why_object_killed why
),
201 TP_ARGS(obj
, de
, to
, why
),
203 /* Note that obj may be NULL */
205 __field(struct cachefiles_object
*, obj
)
206 __field(struct dentry
*, de
)
207 __field(struct dentry
*, to
)
208 __field(enum fscache_why_object_killed
, why
)
218 TP_printk("o=%p d=%p t=%p w=%s",
219 __entry
->obj
, __entry
->de
, __entry
->to
,
220 __print_symbolic(__entry
->why
, cachefiles_obj_kill_traces
))
223 TRACE_EVENT(cachefiles_mark_active
,
224 TP_PROTO(struct cachefiles_object
*obj
,
229 /* Note that obj may be NULL */
231 __field(struct cachefiles_object
*, obj
)
232 __field(struct dentry
*, de
)
240 TP_printk("o=%p d=%p",
241 __entry
->obj
, __entry
->de
)
244 TRACE_EVENT(cachefiles_wait_active
,
245 TP_PROTO(struct cachefiles_object
*obj
,
247 struct cachefiles_object
*xobj
),
249 TP_ARGS(obj
, de
, xobj
),
251 /* Note that obj may be NULL */
253 __field(struct cachefiles_object
*, obj
)
254 __field(struct dentry
*, de
)
255 __field(struct cachefiles_object
*, xobj
)
257 __field(u16
, fsc_flags
)
263 __entry
->xobj
= xobj
;
264 __entry
->flags
= xobj
->flags
;
265 __entry
->fsc_flags
= xobj
->fscache
.flags
;
268 TP_printk("o=%p d=%p wo=%p wf=%x wff=%x",
269 __entry
->obj
, __entry
->de
, __entry
->xobj
,
270 __entry
->flags
, __entry
->fsc_flags
)
273 TRACE_EVENT(cachefiles_mark_inactive
,
274 TP_PROTO(struct cachefiles_object
*obj
,
276 struct inode
*inode
),
278 TP_ARGS(obj
, de
, inode
),
280 /* Note that obj may be NULL */
282 __field(struct cachefiles_object
*, obj
)
283 __field(struct dentry
*, de
)
284 __field(struct inode
*, inode
)
290 __entry
->inode
= inode
;
293 TP_printk("o=%p d=%p i=%p",
294 __entry
->obj
, __entry
->de
, __entry
->inode
)
297 TRACE_EVENT(cachefiles_mark_buried
,
298 TP_PROTO(struct cachefiles_object
*obj
,
300 enum fscache_why_object_killed why
),
302 TP_ARGS(obj
, de
, why
),
304 /* Note that obj may be NULL */
306 __field(struct cachefiles_object
*, obj
)
307 __field(struct dentry
*, de
)
308 __field(enum fscache_why_object_killed
, why
)
317 TP_printk("o=%p d=%p w=%s",
318 __entry
->obj
, __entry
->de
,
319 __print_symbolic(__entry
->why
, cachefiles_obj_kill_traces
))
322 #endif /* _TRACE_CACHEFILES_H */
324 /* This part must be outside protection */
325 #include <trace/define_trace.h>