summaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-04-07 12:08:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-04-07 12:08:24 -0400
commit62f8e6c5dcb6666e7da402aea28fcf846eea144c (patch)
tree2fb8ea1b55b4f0b0592fce715dc7816533609a23 /include/trace
parentf605ba97fb80522656c7dce9825a908f1e765b57 (diff)
parentec0328e46d6e5d0f17372eb90ab8e333c2ac7ca9 (diff)
Merge tag 'fscache-next-20180406' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull fscache updates from David Howells: "Three patches that fix some of AFS's usage of fscache: (1) Need to invalidate the cache if a foreign data change is detected on the server. (2) Move the vnode ID uniquifier (equivalent to i_generation) from the auxiliary data to the index key to prevent a race between file delete and a subsequent file create seeing the same index key. (3) Need to retire cookies that correspond to files that we think got deleted on the server. Four patches to fix some things in fscache and cachefiles: (4) Fix a couple of checker warnings. (5) Correctly indicate to the end-of-operation callback whether an operation completed or was cancelled. (6) Add a check for multiple cookie relinquishment. (7) Fix a path through the asynchronous write that doesn't wake up a waiter for a page if the cache decides not to write that page, but discards it instead. A couple of patches to add tracepoints to fscache and cachefiles: (8) Add tracepoints for cookie operators, object state machine execution, cachefiles object management and cachefiles VFS operations. (9) Add tracepoints for fscache operation management and page wrangling. And then three development patches: (10) Attach the index key and auxiliary data to the cookie, pass this information through various fscache-netfs API functions and get rid of the callbacks to the netfs to get it. This means that the cache can get at this information, even if the netfs goes away. It also means that the cache can be lazy in updating the coherency data. (11) Pass the object data size through various fscache-netfs API rather than calling back to the netfs for it, and store the value in the object. This makes it easier to correctly resize the object, as the size is updated on writes to the cache, rather than calling back out to the netfs. (12) Maintain a catalogue of allocated cookies. This makes it possible to catch cookie collision up front rather than down in the bowels of the cache being run from a service thread from the object state machine. This will also make it possible in the future to reconnect to a cookie that's not gone dead yet because it's waiting for finalisation of the storage and also make it possible to bring cookies online if the cache is added after the cookie has been obtained" * tag 'fscache-next-20180406' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: fscache: Maintain a catalogue of allocated cookies fscache: Pass object size in rather than calling back for it fscache: Attach the index key and aux data to the cookie fscache: Add more tracepoints fscache: Add tracepoints fscache: Fix hanging wait on page discarded by writeback fscache: Detect multiple relinquishment of a cookie fscache: Pass the correct cancelled indications to fscache_op_complete() fscache, cachefiles: Fix checker warnings afs: Be more aggressive in retiring cached vnodes afs: Use the vnode ID uniquifier in the cache key not the aux data afs: Invalidate cache on server data change
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/cachefiles.h325
-rw-r--r--include/trace/events/fscache.h537
2 files changed, 862 insertions, 0 deletions
diff --git a/include/trace/events/cachefiles.h b/include/trace/events/cachefiles.h
new file mode 100644
index 000000000000..aa86e7dba511
--- /dev/null
+++ b/include/trace/events/cachefiles.h
@@ -0,0 +1,325 @@
1/* CacheFiles tracepoints
2 *
3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
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.
10 */
11#undef TRACE_SYSTEM
12#define TRACE_SYSTEM cachefiles
13
14#if !defined(_TRACE_CACHEFILES_H) || defined(TRACE_HEADER_MULTI_READ)
15#define _TRACE_CACHEFILES_H
16
17#include <linux/tracepoint.h>
18
19/*
20 * Define enums for tracing information.
21 */
22#ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
23#define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
24
25enum 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
29};
30
31#endif
32
33/*
34 * Define enum -> string mappings for display.
35 */
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")
41
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")
53
54/*
55 * Export enum symbols via userspace.
56 */
57#undef EM
58#undef E_
59#define EM(a, b) TRACE_DEFINE_ENUM(a);
60#define E_(a, b) TRACE_DEFINE_ENUM(a);
61
62cachefiles_obj_kill_traces;
63cachefiles_obj_ref_traces;
64
65/*
66 * Now redefine the EM() and E_() macros to map the enums to the strings that
67 * will be printed in the output.
68 */
69#undef EM
70#undef E_
71#define EM(a, b) { a, b },
72#define E_(a, b) { a, b }
73
74
75TRACE_EVENT(cachefiles_ref,
76 TP_PROTO(struct cachefiles_object *obj,
77 struct fscache_cookie *cookie,
78 enum cachefiles_obj_ref_trace why,
79 int usage),
80
81 TP_ARGS(obj, cookie, why, usage),
82
83 /* Note that obj may be NULL */
84 TP_STRUCT__entry(
85 __field(struct cachefiles_object *, obj )
86 __field(struct fscache_cookie *, cookie )
87 __field(enum cachefiles_obj_ref_trace, why )
88 __field(int, usage )
89 ),
90
91 TP_fast_assign(
92 __entry->obj = obj;
93 __entry->cookie = cookie;
94 __entry->usage = usage;
95 __entry->why = why;
96 ),
97
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))
101 );
102
103TRACE_EVENT(cachefiles_lookup,
104 TP_PROTO(struct cachefiles_object *obj,
105 struct dentry *de,
106 struct inode *inode),
107
108 TP_ARGS(obj, de, inode),
109
110 TP_STRUCT__entry(
111 __field(struct cachefiles_object *, obj )
112 __field(struct dentry *, de )
113 __field(struct inode *, inode )
114 ),
115
116 TP_fast_assign(
117 __entry->obj = obj;
118 __entry->de = de;
119 __entry->inode = inode;
120 ),
121
122 TP_printk("o=%p d=%p i=%p",
123 __entry->obj, __entry->de, __entry->inode)
124 );
125
126TRACE_EVENT(cachefiles_mkdir,
127 TP_PROTO(struct cachefiles_object *obj,
128 struct dentry *de, int ret),
129
130 TP_ARGS(obj, de, ret),
131
132 TP_STRUCT__entry(
133 __field(struct cachefiles_object *, obj )
134 __field(struct dentry *, de )
135 __field(int, ret )
136 ),
137
138 TP_fast_assign(
139 __entry->obj = obj;
140 __entry->de = de;
141 __entry->ret = ret;
142 ),
143
144 TP_printk("o=%p d=%p r=%u",
145 __entry->obj, __entry->de, __entry->ret)
146 );
147
148TRACE_EVENT(cachefiles_create,
149 TP_PROTO(struct cachefiles_object *obj,
150 struct dentry *de, int ret),
151
152 TP_ARGS(obj, de, ret),
153
154 TP_STRUCT__entry(
155 __field(struct cachefiles_object *, obj )
156 __field(struct dentry *, de )
157 __field(int, ret )
158 ),
159
160 TP_fast_assign(
161 __entry->obj = obj;
162 __entry->de = de;
163 __entry->ret = ret;
164 ),
165
166 TP_printk("o=%p d=%p r=%u",
167 __entry->obj, __entry->de, __entry->ret)
168 );
169
170TRACE_EVENT(cachefiles_unlink,
171 TP_PROTO(struct cachefiles_object *obj,
172 struct dentry *de,
173 enum fscache_why_object_killed why),
174
175 TP_ARGS(obj, de, why),
176
177 /* Note that obj may be NULL */
178 TP_STRUCT__entry(
179 __field(struct cachefiles_object *, obj )
180 __field(struct dentry *, de )
181 __field(enum fscache_why_object_killed, why )
182 ),
183
184 TP_fast_assign(
185 __entry->obj = obj;
186 __entry->de = de;
187 __entry->why = why;
188 ),
189
190 TP_printk("o=%p d=%p w=%s",
191 __entry->obj, __entry->de,
192 __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
193 );
194
195TRACE_EVENT(cachefiles_rename,
196 TP_PROTO(struct cachefiles_object *obj,
197 struct dentry *de,
198 struct dentry *to,
199 enum fscache_why_object_killed why),
200
201 TP_ARGS(obj, de, to, why),
202
203 /* Note that obj may be NULL */
204 TP_STRUCT__entry(
205 __field(struct cachefiles_object *, obj )
206 __field(struct dentry *, de )
207 __field(struct dentry *, to )
208 __field(enum fscache_why_object_killed, why )
209 ),
210
211 TP_fast_assign(
212 __entry->obj = obj;
213 __entry->de = de;
214 __entry->to = to;
215 __entry->why = why;
216 ),
217
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))
221 );
222
223TRACE_EVENT(cachefiles_mark_active,
224 TP_PROTO(struct cachefiles_object *obj,
225 struct dentry *de),
226
227 TP_ARGS(obj, de),
228
229 /* Note that obj may be NULL */
230 TP_STRUCT__entry(
231 __field(struct cachefiles_object *, obj )
232 __field(struct dentry *, de )
233 ),
234
235 TP_fast_assign(
236 __entry->obj = obj;
237 __entry->de = de;
238 ),
239
240 TP_printk("o=%p d=%p",
241 __entry->obj, __entry->de)
242 );
243
244TRACE_EVENT(cachefiles_wait_active,
245 TP_PROTO(struct cachefiles_object *obj,
246 struct dentry *de,
247 struct cachefiles_object *xobj),
248
249 TP_ARGS(obj, de, xobj),
250
251 /* Note that obj may be NULL */
252 TP_STRUCT__entry(
253 __field(struct cachefiles_object *, obj )
254 __field(struct dentry *, de )
255 __field(struct cachefiles_object *, xobj )
256 __field(u16, flags )
257 __field(u16, fsc_flags )
258 ),
259
260 TP_fast_assign(
261 __entry->obj = obj;
262 __entry->de = de;
263 __entry->xobj = xobj;
264 __entry->flags = xobj->flags;
265 __entry->fsc_flags = xobj->fscache.flags;
266 ),
267
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)
271 );
272
273TRACE_EVENT(cachefiles_mark_inactive,
274 TP_PROTO(struct cachefiles_object *obj,
275 struct dentry *de,
276 struct inode *inode),
277
278 TP_ARGS(obj, de, inode),
279
280 /* Note that obj may be NULL */
281 TP_STRUCT__entry(
282 __field(struct cachefiles_object *, obj )
283 __field(struct dentry *, de )
284 __field(struct inode *, inode )
285 ),
286
287 TP_fast_assign(
288 __entry->obj = obj;
289 __entry->de = de;
290 __entry->inode = inode;
291 ),
292
293 TP_printk("o=%p d=%p i=%p",
294 __entry->obj, __entry->de, __entry->inode)
295 );
296
297TRACE_EVENT(cachefiles_mark_buried,
298 TP_PROTO(struct cachefiles_object *obj,
299 struct dentry *de,
300 enum fscache_why_object_killed why),
301
302 TP_ARGS(obj, de, why),
303
304 /* Note that obj may be NULL */
305 TP_STRUCT__entry(
306 __field(struct cachefiles_object *, obj )
307 __field(struct dentry *, de )
308 __field(enum fscache_why_object_killed, why )
309 ),
310
311 TP_fast_assign(
312 __entry->obj = obj;
313 __entry->de = de;
314 __entry->why = why;
315 ),
316
317 TP_printk("o=%p d=%p w=%s",
318 __entry->obj, __entry->de,
319 __print_symbolic(__entry->why, cachefiles_obj_kill_traces))
320 );
321
322#endif /* _TRACE_CACHEFILES_H */
323
324/* This part must be outside protection */
325#include <trace/define_trace.h>
diff --git a/include/trace/events/fscache.h b/include/trace/events/fscache.h
new file mode 100644
index 000000000000..686cfe997ed2
--- /dev/null
+++ b/include/trace/events/fscache.h
@@ -0,0 +1,537 @@
1/* FS-Cache tracepoints
2 *
3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
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.
10 */
11#undef TRACE_SYSTEM
12#define TRACE_SYSTEM fscache
13
14#if !defined(_TRACE_FSCACHE_H) || defined(TRACE_HEADER_MULTI_READ)
15#define _TRACE_FSCACHE_H
16
17#include <linux/fscache.h>
18#include <linux/tracepoint.h>
19
20/*
21 * Define enums for tracing information.
22 */
23#ifndef __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
24#define __FSCACHE_DECLARE_TRACE_ENUMS_ONCE_ONLY
25
26enum fscache_cookie_trace {
27 fscache_cookie_collision,
28 fscache_cookie_discard,
29 fscache_cookie_get_acquire_parent,
30 fscache_cookie_get_attach_object,
31 fscache_cookie_get_reacquire,
32 fscache_cookie_get_register_netfs,
33 fscache_cookie_put_acquire_nobufs,
34 fscache_cookie_put_dup_netfs,
35 fscache_cookie_put_relinquish,
36 fscache_cookie_put_object,
37 fscache_cookie_put_parent,
38};
39
40enum fscache_page_trace {
41 fscache_page_cached,
42 fscache_page_inval,
43 fscache_page_maybe_release,
44 fscache_page_radix_clear_store,
45 fscache_page_radix_delete,
46 fscache_page_radix_insert,
47 fscache_page_radix_pend2store,
48 fscache_page_radix_set_pend,
49 fscache_page_uncache,
50 fscache_page_write,
51 fscache_page_write_end,
52 fscache_page_write_end_pend,
53 fscache_page_write_end_noc,
54 fscache_page_write_wait,
55 fscache_page_trace__nr
56};
57
58enum fscache_op_trace {
59 fscache_op_cancel,
60 fscache_op_cancel_all,
61 fscache_op_cancelled,
62 fscache_op_completed,
63 fscache_op_enqueue_async,
64 fscache_op_enqueue_mythread,
65 fscache_op_gc,
66 fscache_op_init,
67 fscache_op_put,
68 fscache_op_run,
69 fscache_op_signal,
70 fscache_op_submit,
71 fscache_op_submit_ex,
72 fscache_op_work,
73 fscache_op_trace__nr
74};
75
76enum fscache_page_op_trace {
77 fscache_page_op_alloc_one,
78 fscache_page_op_attr_changed,
79 fscache_page_op_check_consistency,
80 fscache_page_op_invalidate,
81 fscache_page_op_retr_multi,
82 fscache_page_op_retr_one,
83 fscache_page_op_write_one,
84 fscache_page_op_trace__nr
85};
86
87#endif
88
89/*
90 * Declare tracing information enums and their string mappings for display.
91 */
92#define fscache_cookie_traces \
93 EM(fscache_cookie_collision, "*COLLISION*") \
94 EM(fscache_cookie_discard, "DISCARD") \
95 EM(fscache_cookie_get_acquire_parent, "GET prn") \
96 EM(fscache_cookie_get_attach_object, "GET obj") \
97 EM(fscache_cookie_get_reacquire, "GET raq") \
98 EM(fscache_cookie_get_register_netfs, "GET net") \
99 EM(fscache_cookie_put_acquire_nobufs, "PUT nbf") \
100 EM(fscache_cookie_put_dup_netfs, "PUT dnt") \
101 EM(fscache_cookie_put_relinquish, "PUT rlq") \
102 EM(fscache_cookie_put_object, "PUT obj") \
103 E_(fscache_cookie_put_parent, "PUT prn")
104
105#define fscache_page_traces \
106 EM(fscache_page_cached, "Cached ") \
107 EM(fscache_page_inval, "InvalPg") \
108 EM(fscache_page_maybe_release, "MayRels") \
109 EM(fscache_page_uncache, "Uncache") \
110 EM(fscache_page_radix_clear_store, "RxCStr ") \
111 EM(fscache_page_radix_delete, "RxDel ") \
112 EM(fscache_page_radix_insert, "RxIns ") \
113 EM(fscache_page_radix_pend2store, "RxP2S ") \
114 EM(fscache_page_radix_set_pend, "RxSPend ") \
115 EM(fscache_page_write, "WritePg") \
116 EM(fscache_page_write_end, "EndPgWr") \
117 EM(fscache_page_write_end_pend, "EndPgWP") \
118 EM(fscache_page_write_end_noc, "EndPgNC") \
119 E_(fscache_page_write_wait, "WtOnWrt")
120
121#define fscache_op_traces \
122 EM(fscache_op_cancel, "Cancel1") \
123 EM(fscache_op_cancel_all, "CancelA") \
124 EM(fscache_op_cancelled, "Canclld") \
125 EM(fscache_op_completed, "Complet") \
126 EM(fscache_op_enqueue_async, "EnqAsyn") \
127 EM(fscache_op_enqueue_mythread, "EnqMyTh") \
128 EM(fscache_op_gc, "GC ") \
129 EM(fscache_op_init, "Init ") \
130 EM(fscache_op_put, "Put ") \
131 EM(fscache_op_run, "Run ") \
132 EM(fscache_op_signal, "Signal ") \
133 EM(fscache_op_submit, "Submit ") \
134 EM(fscache_op_submit_ex, "SubmitX") \
135 E_(fscache_op_work, "Work ")
136
137#define fscache_page_op_traces \
138 EM(fscache_page_op_alloc_one, "Alloc1 ") \
139 EM(fscache_page_op_attr_changed, "AttrChg") \
140 EM(fscache_page_op_check_consistency, "CheckCn") \
141 EM(fscache_page_op_invalidate, "Inval ") \
142 EM(fscache_page_op_retr_multi, "RetrMul") \
143 EM(fscache_page_op_retr_one, "Retr1 ") \
144 E_(fscache_page_op_write_one, "Write1 ")
145
146/*
147 * Export enum symbols via userspace.
148 */
149#undef EM
150#undef E_
151#define EM(a, b) TRACE_DEFINE_ENUM(a);
152#define E_(a, b) TRACE_DEFINE_ENUM(a);
153
154fscache_cookie_traces;
155
156/*
157 * Now redefine the EM() and E_() macros to map the enums to the strings that
158 * will be printed in the output.
159 */
160#undef EM
161#undef E_
162#define EM(a, b) { a, b },
163#define E_(a, b) { a, b }
164
165
166TRACE_EVENT(fscache_cookie,
167 TP_PROTO(struct fscache_cookie *cookie,
168 enum fscache_cookie_trace where,
169 int usage),
170
171 TP_ARGS(cookie, where, usage),
172
173 TP_STRUCT__entry(
174 __field(struct fscache_cookie *, cookie )
175 __field(struct fscache_cookie *, parent )
176 __field(enum fscache_cookie_trace, where )
177 __field(int, usage )
178 __field(int, n_children )
179 __field(int, n_active )
180 __field(u8, flags )
181 ),
182
183 TP_fast_assign(
184 __entry->cookie = cookie;
185 __entry->parent = cookie->parent;
186 __entry->where = where;
187 __entry->usage = usage;
188 __entry->n_children = atomic_read(&cookie->n_children);
189 __entry->n_active = atomic_read(&cookie->n_active);
190 __entry->flags = cookie->flags;
191 ),
192
193 TP_printk("%s c=%p u=%d p=%p Nc=%d Na=%d f=%02x",
194 __print_symbolic(__entry->where, fscache_cookie_traces),
195 __entry->cookie, __entry->usage,
196 __entry->parent, __entry->n_children, __entry->n_active,
197 __entry->flags)
198 );
199
200TRACE_EVENT(fscache_netfs,
201 TP_PROTO(struct fscache_netfs *netfs),
202
203 TP_ARGS(netfs),
204
205 TP_STRUCT__entry(
206 __field(struct fscache_cookie *, cookie )
207 __array(char, name, 8 )
208 ),
209
210 TP_fast_assign(
211 __entry->cookie = netfs->primary_index;
212 strncpy(__entry->name, netfs->name, 8);
213 __entry->name[7] = 0;
214 ),
215
216 TP_printk("c=%p n=%s",
217 __entry->cookie, __entry->name)
218 );
219
220TRACE_EVENT(fscache_acquire,
221 TP_PROTO(struct fscache_cookie *cookie),
222
223 TP_ARGS(cookie),
224
225 TP_STRUCT__entry(
226 __field(struct fscache_cookie *, cookie )
227 __field(struct fscache_cookie *, parent )
228 __array(char, name, 8 )
229 __field(int, p_usage )
230 __field(int, p_n_children )
231 __field(u8, p_flags )
232 ),
233
234 TP_fast_assign(
235 __entry->cookie = cookie;
236 __entry->parent = cookie->parent;
237 __entry->p_usage = atomic_read(&cookie->parent->usage);
238 __entry->p_n_children = atomic_read(&cookie->parent->n_children);
239 __entry->p_flags = cookie->parent->flags;
240 memcpy(__entry->name, cookie->def->name, 8);
241 __entry->name[7] = 0;
242 ),
243
244 TP_printk("c=%p p=%p pu=%d pc=%d pf=%02x n=%s",
245 __entry->cookie, __entry->parent, __entry->p_usage,
246 __entry->p_n_children, __entry->p_flags, __entry->name)
247 );
248
249TRACE_EVENT(fscache_relinquish,
250 TP_PROTO(struct fscache_cookie *cookie, bool retire),
251
252 TP_ARGS(cookie, retire),
253
254 TP_STRUCT__entry(
255 __field(struct fscache_cookie *, cookie )
256 __field(struct fscache_cookie *, parent )
257 __field(int, usage )
258 __field(int, n_children )
259 __field(int, n_active )
260 __field(u8, flags )
261 __field(bool, retire )
262 ),
263
264 TP_fast_assign(
265 __entry->cookie = cookie;
266 __entry->parent = cookie->parent;
267 __entry->usage = atomic_read(&cookie->usage);
268 __entry->n_children = atomic_read(&cookie->n_children);
269 __entry->n_active = atomic_read(&cookie->n_active);
270 __entry->flags = cookie->flags;
271 __entry->retire = retire;
272 ),
273
274 TP_printk("c=%p u=%d p=%p Nc=%d Na=%d f=%02x r=%u",
275 __entry->cookie, __entry->usage,
276 __entry->parent, __entry->n_children, __entry->n_active,
277 __entry->flags, __entry->retire)
278 );
279
280TRACE_EVENT(fscache_enable,
281 TP_PROTO(struct fscache_cookie *cookie),
282
283 TP_ARGS(cookie),
284
285 TP_STRUCT__entry(
286 __field(struct fscache_cookie *, cookie )
287 __field(int, usage )
288 __field(int, n_children )
289 __field(int, n_active )
290 __field(u8, flags )
291 ),
292
293 TP_fast_assign(
294 __entry->cookie = cookie;
295 __entry->usage = atomic_read(&cookie->usage);
296 __entry->n_children = atomic_read(&cookie->n_children);
297 __entry->n_active = atomic_read(&cookie->n_active);
298 __entry->flags = cookie->flags;
299 ),
300
301 TP_printk("c=%p u=%d Nc=%d Na=%d f=%02x",
302 __entry->cookie, __entry->usage,
303 __entry->n_children, __entry->n_active, __entry->flags)
304 );
305
306TRACE_EVENT(fscache_disable,
307 TP_PROTO(struct fscache_cookie *cookie),
308
309 TP_ARGS(cookie),
310
311 TP_STRUCT__entry(
312 __field(struct fscache_cookie *, cookie )
313 __field(int, usage )
314 __field(int, n_children )
315 __field(int, n_active )
316 __field(u8, flags )
317 ),
318
319 TP_fast_assign(
320 __entry->cookie = cookie;
321 __entry->usage = atomic_read(&cookie->usage);
322 __entry->n_children = atomic_read(&cookie->n_children);
323 __entry->n_active = atomic_read(&cookie->n_active);
324 __entry->flags = cookie->flags;
325 ),
326
327 TP_printk("c=%p u=%d Nc=%d Na=%d f=%02x",
328 __entry->cookie, __entry->usage,
329 __entry->n_children, __entry->n_active, __entry->flags)
330 );
331
332TRACE_EVENT(fscache_osm,
333 TP_PROTO(struct fscache_object *object,
334 const struct fscache_state *state,
335 bool wait, bool oob, s8 event_num),
336
337 TP_ARGS(object, state, wait, oob, event_num),
338
339 TP_STRUCT__entry(
340 __field(struct fscache_cookie *, cookie )
341 __field(struct fscache_object *, object )
342 __array(char, state, 8 )
343 __field(bool, wait )
344 __field(bool, oob )
345 __field(s8, event_num )
346 ),
347
348 TP_fast_assign(
349 __entry->cookie = object->cookie;
350 __entry->object = object;
351 __entry->wait = wait;
352 __entry->oob = oob;
353 __entry->event_num = event_num;
354 memcpy(__entry->state, state->short_name, 8);
355 ),
356
357 TP_printk("c=%p o=%p %s %s%sev=%d",
358 __entry->cookie,
359 __entry->object,
360 __entry->state,
361 __print_symbolic(__entry->wait,
362 { true, "WAIT" },
363 { false, "WORK" }),
364 __print_symbolic(__entry->oob,
365 { true, " OOB " },
366 { false, " " }),
367 __entry->event_num)
368 );
369
370TRACE_EVENT(fscache_page,
371 TP_PROTO(struct fscache_cookie *cookie, struct page *page,
372 enum fscache_page_trace why),
373
374 TP_ARGS(cookie, page, why),
375
376 TP_STRUCT__entry(
377 __field(struct fscache_cookie *, cookie )
378 __field(pgoff_t, page )
379 __field(enum fscache_page_trace, why )
380 ),
381
382 TP_fast_assign(
383 __entry->cookie = cookie;
384 __entry->page = page->index;
385 __entry->why = why;
386 ),
387
388 TP_printk("c=%p %s pg=%lx",
389 __entry->cookie,
390 __print_symbolic(__entry->why, fscache_page_traces),
391 __entry->page)
392 );
393
394TRACE_EVENT(fscache_check_page,
395 TP_PROTO(struct fscache_cookie *cookie, struct page *page,
396 void *val, int n),
397
398 TP_ARGS(cookie, page, val, n),
399
400 TP_STRUCT__entry(
401 __field(struct fscache_cookie *, cookie )
402 __field(void *, page )
403 __field(void *, val )
404 __field(int, n )
405 ),
406
407 TP_fast_assign(
408 __entry->cookie = cookie;
409 __entry->page = page;
410 __entry->val = val;
411 __entry->n = n;
412 ),
413
414 TP_printk("c=%p pg=%p val=%p n=%d",
415 __entry->cookie, __entry->page, __entry->val, __entry->n)
416 );
417
418TRACE_EVENT(fscache_wake_cookie,
419 TP_PROTO(struct fscache_cookie *cookie),
420
421 TP_ARGS(cookie),
422
423 TP_STRUCT__entry(
424 __field(struct fscache_cookie *, cookie )
425 ),
426
427 TP_fast_assign(
428 __entry->cookie = cookie;
429 ),
430
431 TP_printk("c=%p", __entry->cookie)
432 );
433
434TRACE_EVENT(fscache_op,
435 TP_PROTO(struct fscache_cookie *cookie, struct fscache_operation *op,
436 enum fscache_op_trace why),
437
438 TP_ARGS(cookie, op, why),
439
440 TP_STRUCT__entry(
441 __field(struct fscache_cookie *, cookie )
442 __field(struct fscache_operation *, op )
443 __field(enum fscache_op_trace, why )
444 ),
445
446 TP_fast_assign(
447 __entry->cookie = cookie;
448 __entry->op = op;
449 __entry->why = why;
450 ),
451
452 TP_printk("c=%p op=%p %s",
453 __entry->cookie, __entry->op,
454 __print_symbolic(__entry->why, fscache_op_traces))
455 );
456
457TRACE_EVENT(fscache_page_op,
458 TP_PROTO(struct fscache_cookie *cookie, struct page *page,
459 struct fscache_operation *op, enum fscache_page_op_trace what),
460
461 TP_ARGS(cookie, page, op, what),
462
463 TP_STRUCT__entry(
464 __field(struct fscache_cookie *, cookie )
465 __field(pgoff_t, page )
466 __field(struct fscache_operation *, op )
467 __field(enum fscache_page_op_trace, what )
468 ),
469
470 TP_fast_assign(
471 __entry->cookie = cookie;
472 __entry->page = page ? page->index : 0;
473 __entry->op = op;
474 __entry->what = what;
475 ),
476
477 TP_printk("c=%p %s pg=%lx op=%p",
478 __entry->cookie,
479 __print_symbolic(__entry->what, fscache_page_op_traces),
480 __entry->page, __entry->op)
481 );
482
483TRACE_EVENT(fscache_wrote_page,
484 TP_PROTO(struct fscache_cookie *cookie, struct page *page,
485 struct fscache_operation *op, int ret),
486
487 TP_ARGS(cookie, page, op, ret),
488
489 TP_STRUCT__entry(
490 __field(struct fscache_cookie *, cookie )
491 __field(pgoff_t, page )
492 __field(struct fscache_operation *, op )
493 __field(int, ret )
494 ),
495
496 TP_fast_assign(
497 __entry->cookie = cookie;
498 __entry->page = page->index;
499 __entry->op = op;
500 __entry->ret = ret;
501 ),
502
503 TP_printk("c=%p pg=%lx op=%p ret=%d",
504 __entry->cookie, __entry->page, __entry->op, __entry->ret)
505 );
506
507TRACE_EVENT(fscache_gang_lookup,
508 TP_PROTO(struct fscache_cookie *cookie, struct fscache_operation *op,
509 void **results, int n, pgoff_t store_limit),
510
511 TP_ARGS(cookie, op, results, n, store_limit),
512
513 TP_STRUCT__entry(
514 __field(struct fscache_cookie *, cookie )
515 __field(struct fscache_operation *, op )
516 __field(pgoff_t, results0 )
517 __field(int, n )
518 __field(pgoff_t, store_limit )
519 ),
520
521 TP_fast_assign(
522 __entry->cookie = cookie;
523 __entry->op = op;
524 __entry->results0 = results[0] ? ((struct page *)results[0])->index : (pgoff_t)-1;
525 __entry->n = n;
526 __entry->store_limit = store_limit;
527 ),
528
529 TP_printk("c=%p op=%p r0=%lx n=%d sl=%lx",
530 __entry->cookie, __entry->op, __entry->results0, __entry->n,
531 __entry->store_limit)
532 );
533
534#endif /* _TRACE_FSCACHE_H */
535
536/* This part must be outside protection */
537#include <trace/define_trace.h>