1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* CacheFiles tracepoints
4 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #define TRACE_SYSTEM cachefiles
10 #if !defined(_TRACE_CACHEFILES_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_CACHEFILES_H
13 #include <linux/tracepoint.h>
16 * Define enums for tracing information.
18 #ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
19 #define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
21 enum cachefiles_obj_ref_trace
{
22 cachefiles_obj_put_wait_retry
= fscache_obj_ref__nr_traces
,
23 cachefiles_obj_put_wait_timeo
,
24 cachefiles_obj_ref__nr_traces
30 * Define enum -> string mappings for display.
32 #define cachefiles_obj_kill_traces \
33 EM(FSCACHE_OBJECT_IS_STALE, "stale") \
34 EM(FSCACHE_OBJECT_NO_SPACE, "no_space") \
35 EM(FSCACHE_OBJECT_WAS_RETIRED, "was_retired") \
36 E_(FSCACHE_OBJECT_WAS_CULLED, "was_culled")
38 #define cachefiles_obj_ref_traces \
39 EM(fscache_obj_get_add_to_deps, "GET add_to_deps") \
40 EM(fscache_obj_get_queue, "GET queue") \
41 EM(fscache_obj_put_alloc_fail, "PUT alloc_fail") \
42 EM(fscache_obj_put_attach_fail, "PUT attach_fail") \
43 EM(fscache_obj_put_drop_obj, "PUT drop_obj") \
44 EM(fscache_obj_put_enq_dep, "PUT enq_dep") \
45 EM(fscache_obj_put_queue, "PUT queue") \
46 EM(fscache_obj_put_work, "PUT work") \
47 EM(cachefiles_obj_put_wait_retry, "PUT wait_retry") \
48 E_(cachefiles_obj_put_wait_timeo, "PUT wait_timeo")
51 * Export enum symbols via userspace.
55 #define EM(a, b) TRACE_DEFINE_ENUM(a);
56 #define E_(a, b) TRACE_DEFINE_ENUM(a);
58 cachefiles_obj_kill_traces
;
59 cachefiles_obj_ref_traces
;
62 * Now redefine the EM() and E_() macros to map the enums to the strings that
63 * will be printed in the output.
67 #define EM(a, b) { a, b },
68 #define E_(a, b) { a, b }
71 TRACE_EVENT(cachefiles_ref
,
72 TP_PROTO(struct cachefiles_object
*obj
,
73 struct fscache_cookie
*cookie
,
74 enum cachefiles_obj_ref_trace why
,
77 TP_ARGS(obj
, cookie
, why
, usage
),
79 /* Note that obj may be NULL */
81 __field(struct cachefiles_object
*, obj
)
82 __field(struct fscache_cookie
*, cookie
)
83 __field(enum cachefiles_obj_ref_trace
, why
)
89 __entry
->cookie
= cookie
;
90 __entry
->usage
= usage
;
94 TP_printk("c=%p o=%p u=%d %s",
95 __entry
->cookie
, __entry
->obj
, __entry
->usage
,
96 __print_symbolic(__entry
->why
, cachefiles_obj_ref_traces
))
99 TRACE_EVENT(cachefiles_lookup
,
100 TP_PROTO(struct cachefiles_object
*obj
,
102 struct inode
*inode
),
104 TP_ARGS(obj
, de
, inode
),
107 __field(struct cachefiles_object
*, obj
)
108 __field(struct dentry
*, de
)
109 __field(struct inode
*, inode
)
115 __entry
->inode
= inode
;
118 TP_printk("o=%p d=%p i=%p",
119 __entry
->obj
, __entry
->de
, __entry
->inode
)
122 TRACE_EVENT(cachefiles_mkdir
,
123 TP_PROTO(struct cachefiles_object
*obj
,
124 struct dentry
*de
, int ret
),
126 TP_ARGS(obj
, de
, ret
),
129 __field(struct cachefiles_object
*, obj
)
130 __field(struct dentry
*, de
)
140 TP_printk("o=%p d=%p r=%u",
141 __entry
->obj
, __entry
->de
, __entry
->ret
)
144 TRACE_EVENT(cachefiles_create
,
145 TP_PROTO(struct cachefiles_object
*obj
,
146 struct dentry
*de
, int ret
),
148 TP_ARGS(obj
, de
, ret
),
151 __field(struct cachefiles_object
*, obj
)
152 __field(struct dentry
*, de
)
162 TP_printk("o=%p d=%p r=%u",
163 __entry
->obj
, __entry
->de
, __entry
->ret
)
166 TRACE_EVENT(cachefiles_unlink
,
167 TP_PROTO(struct cachefiles_object
*obj
,
169 enum fscache_why_object_killed why
),
171 TP_ARGS(obj
, de
, why
),
173 /* Note that obj may be NULL */
175 __field(struct cachefiles_object
*, obj
)
176 __field(struct dentry
*, de
)
177 __field(enum fscache_why_object_killed
, why
)
186 TP_printk("o=%p d=%p w=%s",
187 __entry
->obj
, __entry
->de
,
188 __print_symbolic(__entry
->why
, cachefiles_obj_kill_traces
))
191 TRACE_EVENT(cachefiles_rename
,
192 TP_PROTO(struct cachefiles_object
*obj
,
195 enum fscache_why_object_killed why
),
197 TP_ARGS(obj
, de
, to
, why
),
199 /* Note that obj may be NULL */
201 __field(struct cachefiles_object
*, obj
)
202 __field(struct dentry
*, de
)
203 __field(struct dentry
*, to
)
204 __field(enum fscache_why_object_killed
, why
)
214 TP_printk("o=%p d=%p t=%p w=%s",
215 __entry
->obj
, __entry
->de
, __entry
->to
,
216 __print_symbolic(__entry
->why
, cachefiles_obj_kill_traces
))
219 TRACE_EVENT(cachefiles_mark_active
,
220 TP_PROTO(struct cachefiles_object
*obj
,
225 /* Note that obj may be NULL */
227 __field(struct cachefiles_object
*, obj
)
228 __field(struct dentry
*, de
)
236 TP_printk("o=%p d=%p",
237 __entry
->obj
, __entry
->de
)
240 TRACE_EVENT(cachefiles_wait_active
,
241 TP_PROTO(struct cachefiles_object
*obj
,
243 struct cachefiles_object
*xobj
),
245 TP_ARGS(obj
, de
, xobj
),
247 /* Note that obj may be NULL */
249 __field(struct cachefiles_object
*, obj
)
250 __field(struct dentry
*, de
)
251 __field(struct cachefiles_object
*, xobj
)
253 __field(u16
, fsc_flags
)
259 __entry
->xobj
= xobj
;
260 __entry
->flags
= xobj
->flags
;
261 __entry
->fsc_flags
= xobj
->fscache
.flags
;
264 TP_printk("o=%p d=%p wo=%p wf=%x wff=%x",
265 __entry
->obj
, __entry
->de
, __entry
->xobj
,
266 __entry
->flags
, __entry
->fsc_flags
)
269 TRACE_EVENT(cachefiles_mark_inactive
,
270 TP_PROTO(struct cachefiles_object
*obj
,
272 struct inode
*inode
),
274 TP_ARGS(obj
, de
, inode
),
276 /* Note that obj may be NULL */
278 __field(struct cachefiles_object
*, obj
)
279 __field(struct dentry
*, de
)
280 __field(struct inode
*, inode
)
286 __entry
->inode
= inode
;
289 TP_printk("o=%p d=%p i=%p",
290 __entry
->obj
, __entry
->de
, __entry
->inode
)
293 TRACE_EVENT(cachefiles_mark_buried
,
294 TP_PROTO(struct cachefiles_object
*obj
,
296 enum fscache_why_object_killed why
),
298 TP_ARGS(obj
, de
, why
),
300 /* Note that obj may be NULL */
302 __field(struct cachefiles_object
*, obj
)
303 __field(struct dentry
*, de
)
304 __field(enum fscache_why_object_killed
, why
)
313 TP_printk("o=%p d=%p w=%s",
314 __entry
->obj
, __entry
->de
,
315 __print_symbolic(__entry
->why
, cachefiles_obj_kill_traces
))
318 #endif /* _TRACE_CACHEFILES_H */
320 /* This part must be outside protection */
321 #include <trace/define_trace.h>