afs: Don't over-increment the cell usage count when pinning it
[linux-block.git] / include / trace / events / afs.h
CommitLineData
8e8d7f13
DH
1/* AFS 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 afs
13
14#if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ)
15#define _TRACE_AFS_H
16
17#include <linux/tracepoint.h>
18
341f741f
DH
19/*
20 * Define enums for tracing information.
21 */
22#ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
23#define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
24
25enum afs_call_trace {
26 afs_call_trace_alloc,
27 afs_call_trace_free,
28 afs_call_trace_put,
29 afs_call_trace_wake,
30 afs_call_trace_work,
31};
32
025db80c
DH
33enum afs_fs_operation {
34 afs_FS_FetchData = 130, /* AFS Fetch file data */
35 afs_FS_FetchStatus = 132, /* AFS Fetch file status */
36 afs_FS_StoreData = 133, /* AFS Store file data */
37 afs_FS_StoreStatus = 135, /* AFS Store file status */
38 afs_FS_RemoveFile = 136, /* AFS Remove a file */
39 afs_FS_CreateFile = 137, /* AFS Create a file */
40 afs_FS_Rename = 138, /* AFS Rename or move a file or directory */
41 afs_FS_Symlink = 139, /* AFS Create a symbolic link */
42 afs_FS_Link = 140, /* AFS Create a hard link */
43 afs_FS_MakeDir = 141, /* AFS Create a directory */
44 afs_FS_RemoveDir = 142, /* AFS Remove a directory */
45 afs_FS_GetVolumeInfo = 148, /* AFS Get information about a volume */
46 afs_FS_GetVolumeStatus = 149, /* AFS Get volume status information */
47 afs_FS_GetRootVolume = 151, /* AFS Get root volume name */
48 afs_FS_SetLock = 156, /* AFS Request a file lock */
49 afs_FS_ExtendLock = 157, /* AFS Extend a file lock */
50 afs_FS_ReleaseLock = 158, /* AFS Release a file lock */
51 afs_FS_Lookup = 161, /* AFS lookup file in directory */
52 afs_FS_FetchData64 = 65537, /* AFS Fetch file data */
53 afs_FS_StoreData64 = 65538, /* AFS Store file data */
54 afs_FS_GiveUpAllCallBacks = 65539, /* AFS Give up all our callbacks on a server */
55 afs_FS_GetCapabilities = 65540, /* AFS Get FS server capabilities */
56};
57
58enum afs_vl_operation {
59 afs_VL_GetEntryByNameU = 527, /* AFS Get Vol Entry By Name operation ID */
60 afs_VL_GetAddrsU = 533, /* AFS Get FS server addresses */
61 afs_YFSVL_GetEndpoints = 64002, /* YFS Get FS & Vol server addresses */
62 afs_VL_GetCapabilities = 65537, /* AFS Get VL server capabilities */
63};
64
341f741f
DH
65#endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
66
67/*
68 * Declare tracing information enums and their string mappings for display.
69 */
70#define afs_call_traces \
71 EM(afs_call_trace_alloc, "ALLOC") \
72 EM(afs_call_trace_free, "FREE ") \
73 EM(afs_call_trace_put, "PUT ") \
74 EM(afs_call_trace_wake, "WAKE ") \
75 E_(afs_call_trace_work, "WORK ")
76
025db80c
DH
77#define afs_fs_operations \
78 EM(afs_FS_FetchData, "FS.FetchData") \
79 EM(afs_FS_FetchStatus, "FS.FetchStatus") \
80 EM(afs_FS_StoreData, "FS.StoreData") \
81 EM(afs_FS_StoreStatus, "FS.StoreStatus") \
82 EM(afs_FS_RemoveFile, "FS.RemoveFile") \
83 EM(afs_FS_CreateFile, "FS.CreateFile") \
84 EM(afs_FS_Rename, "FS.Rename") \
85 EM(afs_FS_Symlink, "FS.Symlink") \
86 EM(afs_FS_Link, "FS.Link") \
87 EM(afs_FS_MakeDir, "FS.MakeDir") \
88 EM(afs_FS_RemoveDir, "FS.RemoveDir") \
89 EM(afs_FS_GetVolumeInfo, "FS.GetVolumeInfo") \
90 EM(afs_FS_GetVolumeStatus, "FS.GetVolumeStatus") \
91 EM(afs_FS_GetRootVolume, "FS.GetRootVolume") \
92 EM(afs_FS_SetLock, "FS.SetLock") \
93 EM(afs_FS_ExtendLock, "FS.ExtendLock") \
94 EM(afs_FS_ReleaseLock, "FS.ReleaseLock") \
95 EM(afs_FS_Lookup, "FS.Lookup") \
96 EM(afs_FS_FetchData64, "FS.FetchData64") \
97 EM(afs_FS_StoreData64, "FS.StoreData64") \
98 EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \
99 E_(afs_FS_GetCapabilities, "FS.GetCapabilities")
100
101#define afs_vl_operations \
102 EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \
103 EM(afs_VL_GetAddrsU, "VL.GetAddrsU") \
104 EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \
105 E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
106
107
341f741f
DH
108/*
109 * Export enum symbols via userspace.
110 */
111#undef EM
112#undef E_
113#define EM(a, b) TRACE_DEFINE_ENUM(a);
114#define E_(a, b) TRACE_DEFINE_ENUM(a);
115
116afs_call_traces;
025db80c
DH
117afs_fs_operations;
118afs_vl_operations;
341f741f
DH
119
120/*
121 * Now redefine the EM() and E_() macros to map the enums to the strings that
122 * will be printed in the output.
123 */
124#undef EM
125#undef E_
126#define EM(a, b) { a, b },
127#define E_(a, b) { a, b }
128
8e8d7f13
DH
129TRACE_EVENT(afs_recv_data,
130 TP_PROTO(struct afs_call *call, unsigned count, unsigned offset,
131 bool want_more, int ret),
132
133 TP_ARGS(call, count, offset, want_more, ret),
134
135 TP_STRUCT__entry(
a25e21f0 136 __field(unsigned int, call )
8e8d7f13
DH
137 __field(enum afs_call_state, state )
138 __field(unsigned int, count )
139 __field(unsigned int, offset )
140 __field(unsigned short, unmarshall )
141 __field(bool, want_more )
142 __field(int, ret )
143 ),
144
145 TP_fast_assign(
a25e21f0 146 __entry->call = call->debug_id;
8e8d7f13
DH
147 __entry->state = call->state;
148 __entry->unmarshall = call->unmarshall;
149 __entry->count = count;
150 __entry->offset = offset;
151 __entry->want_more = want_more;
152 __entry->ret = ret;
153 ),
154
a25e21f0 155 TP_printk("c=%08x s=%u u=%u %u/%u wm=%u ret=%d",
8e8d7f13
DH
156 __entry->call,
157 __entry->state, __entry->unmarshall,
158 __entry->offset, __entry->count,
159 __entry->want_more, __entry->ret)
160 );
161
162TRACE_EVENT(afs_notify_call,
163 TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
164
165 TP_ARGS(rxcall, call),
166
167 TP_STRUCT__entry(
a25e21f0 168 __field(unsigned int, call )
8e8d7f13
DH
169 __field(enum afs_call_state, state )
170 __field(unsigned short, unmarshall )
171 ),
172
173 TP_fast_assign(
a25e21f0 174 __entry->call = call->debug_id;
8e8d7f13
DH
175 __entry->state = call->state;
176 __entry->unmarshall = call->unmarshall;
177 ),
178
a25e21f0 179 TP_printk("c=%08x s=%u u=%u",
8e8d7f13
DH
180 __entry->call,
181 __entry->state, __entry->unmarshall)
182 );
183
184TRACE_EVENT(afs_cb_call,
185 TP_PROTO(struct afs_call *call),
186
187 TP_ARGS(call),
188
189 TP_STRUCT__entry(
a25e21f0 190 __field(unsigned int, call )
8e8d7f13
DH
191 __field(const char *, name )
192 __field(u32, op )
193 ),
194
195 TP_fast_assign(
a25e21f0 196 __entry->call = call->debug_id;
8e8d7f13
DH
197 __entry->name = call->type->name;
198 __entry->op = call->operation_ID;
199 ),
200
a25e21f0 201 TP_printk("c=%08x %s o=%u",
8e8d7f13
DH
202 __entry->call,
203 __entry->name,
204 __entry->op)
205 );
206
341f741f
DH
207TRACE_EVENT(afs_call,
208 TP_PROTO(struct afs_call *call, enum afs_call_trace op,
209 int usage, int outstanding, const void *where),
210
211 TP_ARGS(call, op, usage, outstanding, where),
212
213 TP_STRUCT__entry(
a25e21f0 214 __field(unsigned int, call )
341f741f
DH
215 __field(int, op )
216 __field(int, usage )
217 __field(int, outstanding )
218 __field(const void *, where )
219 ),
220
221 TP_fast_assign(
a25e21f0 222 __entry->call = call->debug_id;
341f741f
DH
223 __entry->op = op;
224 __entry->usage = usage;
225 __entry->outstanding = outstanding;
226 __entry->where = where;
227 ),
228
a25e21f0 229 TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
341f741f
DH
230 __entry->call,
231 __print_symbolic(__entry->op, afs_call_traces),
232 __entry->usage,
233 __entry->outstanding,
234 __entry->where)
235 );
236
025db80c
DH
237TRACE_EVENT(afs_make_fs_call,
238 TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
239
240 TP_ARGS(call, fid),
241
242 TP_STRUCT__entry(
a25e21f0 243 __field(unsigned int, call )
025db80c
DH
244 __field(enum afs_fs_operation, op )
245 __field_struct(struct afs_fid, fid )
246 ),
247
248 TP_fast_assign(
a25e21f0 249 __entry->call = call->debug_id;
025db80c
DH
250 __entry->op = call->operation_ID;
251 if (fid) {
252 __entry->fid = *fid;
253 } else {
254 __entry->fid.vid = 0;
255 __entry->fid.vnode = 0;
256 __entry->fid.unique = 0;
257 }
258 ),
259
a25e21f0 260 TP_printk("c=%08x %06x:%06x:%06x %s",
025db80c
DH
261 __entry->call,
262 __entry->fid.vid,
263 __entry->fid.vnode,
264 __entry->fid.unique,
265 __print_symbolic(__entry->op, afs_fs_operations))
266 );
267
268TRACE_EVENT(afs_make_vl_call,
269 TP_PROTO(struct afs_call *call),
270
271 TP_ARGS(call),
272
273 TP_STRUCT__entry(
a25e21f0 274 __field(unsigned int, call )
025db80c
DH
275 __field(enum afs_vl_operation, op )
276 ),
277
278 TP_fast_assign(
a25e21f0 279 __entry->call = call->debug_id;
025db80c
DH
280 __entry->op = call->operation_ID;
281 ),
282
a25e21f0 283 TP_printk("c=%08x %s",
025db80c
DH
284 __entry->call,
285 __print_symbolic(__entry->op, afs_vl_operations))
286 );
287
288TRACE_EVENT(afs_call_done,
289 TP_PROTO(struct afs_call *call),
290
291 TP_ARGS(call),
292
293 TP_STRUCT__entry(
a25e21f0 294 __field(unsigned int, call )
025db80c
DH
295 __field(struct rxrpc_call *, rx_call )
296 __field(int, ret )
297 __field(u32, abort_code )
298 ),
299
300 TP_fast_assign(
a25e21f0 301 __entry->call = call->debug_id;
025db80c
DH
302 __entry->rx_call = call->rxcall;
303 __entry->ret = call->error;
304 __entry->abort_code = call->abort_code;
305 ),
306
a25e21f0 307 TP_printk(" c=%08x ret=%d ab=%d [%p]",
025db80c
DH
308 __entry->call,
309 __entry->ret,
310 __entry->abort_code,
311 __entry->rx_call)
312 );
313
2c099014
DH
314TRACE_EVENT(afs_send_pages,
315 TP_PROTO(struct afs_call *call, struct msghdr *msg,
316 pgoff_t first, pgoff_t last, unsigned int offset),
317
318 TP_ARGS(call, msg, first, last, offset),
319
320 TP_STRUCT__entry(
a25e21f0 321 __field(unsigned int, call )
2c099014
DH
322 __field(pgoff_t, first )
323 __field(pgoff_t, last )
324 __field(unsigned int, nr )
325 __field(unsigned int, bytes )
326 __field(unsigned int, offset )
327 __field(unsigned int, flags )
328 ),
329
330 TP_fast_assign(
a25e21f0 331 __entry->call = call->debug_id;
2c099014
DH
332 __entry->first = first;
333 __entry->last = last;
334 __entry->nr = msg->msg_iter.nr_segs;
335 __entry->bytes = msg->msg_iter.count;
336 __entry->offset = offset;
337 __entry->flags = msg->msg_flags;
338 ),
339
a25e21f0 340 TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
2c099014
DH
341 __entry->call,
342 __entry->first, __entry->first + __entry->nr - 1, __entry->last,
343 __entry->bytes, __entry->offset,
344 __entry->flags)
345 );
346
347TRACE_EVENT(afs_sent_pages,
348 TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
349 pgoff_t cursor, int ret),
350
351 TP_ARGS(call, first, last, cursor, ret),
352
353 TP_STRUCT__entry(
a25e21f0 354 __field(unsigned int, call )
2c099014
DH
355 __field(pgoff_t, first )
356 __field(pgoff_t, last )
357 __field(pgoff_t, cursor )
358 __field(int, ret )
359 ),
360
361 TP_fast_assign(
a25e21f0 362 __entry->call = call->debug_id;
2c099014
DH
363 __entry->first = first;
364 __entry->last = last;
365 __entry->cursor = cursor;
366 __entry->ret = ret;
367 ),
368
a25e21f0 369 TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
2c099014
DH
370 __entry->call,
371 __entry->first, __entry->last,
372 __entry->cursor, __entry->ret)
373 );
374
dab17c1a
DH
375TRACE_EVENT(afs_dir_check_failed,
376 TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
377
378 TP_ARGS(vnode, off, i_size),
379
380 TP_STRUCT__entry(
381 __field(struct afs_vnode *, vnode )
382 __field(loff_t, off )
383 __field(loff_t, i_size )
384 ),
385
386 TP_fast_assign(
387 __entry->vnode = vnode;
388 __entry->off = off;
389 __entry->i_size = i_size;
390 ),
391
392 TP_printk("vn=%p %llx/%llx",
393 __entry->vnode, __entry->off, __entry->i_size)
394 );
395
13524ab3
DH
396/*
397 * We use page->private to hold the amount of the page that we've written to,
398 * splitting the field into two parts. However, we need to represent a range
399 * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
400 */
401#if PAGE_SIZE > 32768
402#define AFS_PRIV_MAX 0xffffffff
403#define AFS_PRIV_SHIFT 32
404#else
405#define AFS_PRIV_MAX 0xffff
406#define AFS_PRIV_SHIFT 16
407#endif
408
409TRACE_EVENT(afs_page_dirty,
410 TP_PROTO(struct afs_vnode *vnode, const char *where,
411 pgoff_t page, unsigned long priv),
412
413 TP_ARGS(vnode, where, page, priv),
414
415 TP_STRUCT__entry(
416 __field(struct afs_vnode *, vnode )
417 __field(const char *, where )
418 __field(pgoff_t, page )
419 __field(unsigned long, priv )
420 ),
421
422 TP_fast_assign(
423 __entry->vnode = vnode;
424 __entry->where = where;
425 __entry->page = page;
426 __entry->priv = priv;
427 ),
428
429 TP_printk("vn=%p %lx %s %lu-%lu",
430 __entry->vnode, __entry->page, __entry->where,
431 __entry->priv & AFS_PRIV_MAX,
432 __entry->priv >> AFS_PRIV_SHIFT)
433 );
434
98bf40cd
DH
435TRACE_EVENT(afs_call_state,
436 TP_PROTO(struct afs_call *call,
437 enum afs_call_state from,
438 enum afs_call_state to,
439 int ret, u32 remote_abort),
440
441 TP_ARGS(call, from, to, ret, remote_abort),
442
443 TP_STRUCT__entry(
a25e21f0 444 __field(unsigned int, call )
98bf40cd
DH
445 __field(enum afs_call_state, from )
446 __field(enum afs_call_state, to )
447 __field(int, ret )
448 __field(u32, abort )
449 ),
450
451 TP_fast_assign(
a25e21f0 452 __entry->call = call->debug_id;
98bf40cd
DH
453 __entry->from = from;
454 __entry->to = to;
455 __entry->ret = ret;
456 __entry->abort = remote_abort;
457 ),
458
a25e21f0 459 TP_printk("c=%08x %u->%u r=%d ab=%d",
98bf40cd
DH
460 __entry->call,
461 __entry->from, __entry->to,
462 __entry->ret, __entry->abort)
463 );
464
8e8d7f13
DH
465#endif /* _TRACE_AFS_H */
466
467/* This part must be outside protection */
468#include <trace/define_trace.h>