Merge branch 'work.get_user_pages_fast' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / include / trace / events / afs.h
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
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
25 enum 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
33 enum 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
58 enum 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
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
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
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
116 afs_call_traces;
117 afs_fs_operations;
118 afs_vl_operations;
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
129 TRACE_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(
136                     __field(struct rxrpc_call *,        rxcall          )
137                     __field(struct afs_call *,          call            )
138                     __field(enum afs_call_state,        state           )
139                     __field(unsigned int,               count           )
140                     __field(unsigned int,               offset          )
141                     __field(unsigned short,             unmarshall      )
142                     __field(bool,                       want_more       )
143                     __field(int,                        ret             )
144                              ),
145
146             TP_fast_assign(
147                     __entry->rxcall     = call->rxcall;
148                     __entry->call       = call;
149                     __entry->state      = call->state;
150                     __entry->unmarshall = call->unmarshall;
151                     __entry->count      = count;
152                     __entry->offset     = offset;
153                     __entry->want_more  = want_more;
154                     __entry->ret        = ret;
155                            ),
156
157             TP_printk("c=%p ac=%p s=%u u=%u %u/%u wm=%u ret=%d",
158                       __entry->rxcall,
159                       __entry->call,
160                       __entry->state, __entry->unmarshall,
161                       __entry->offset, __entry->count,
162                       __entry->want_more, __entry->ret)
163             );
164
165 TRACE_EVENT(afs_notify_call,
166             TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
167
168             TP_ARGS(rxcall, call),
169
170             TP_STRUCT__entry(
171                     __field(struct rxrpc_call *,        rxcall          )
172                     __field(struct afs_call *,          call            )
173                     __field(enum afs_call_state,        state           )
174                     __field(unsigned short,             unmarshall      )
175                              ),
176
177             TP_fast_assign(
178                     __entry->rxcall     = rxcall;
179                     __entry->call       = call;
180                     __entry->state      = call->state;
181                     __entry->unmarshall = call->unmarshall;
182                            ),
183
184             TP_printk("c=%p ac=%p s=%u u=%u",
185                       __entry->rxcall,
186                       __entry->call,
187                       __entry->state, __entry->unmarshall)
188             );
189
190 TRACE_EVENT(afs_cb_call,
191             TP_PROTO(struct afs_call *call),
192
193             TP_ARGS(call),
194
195             TP_STRUCT__entry(
196                     __field(struct rxrpc_call *,        rxcall          )
197                     __field(struct afs_call *,          call            )
198                     __field(const char *,               name            )
199                     __field(u32,                        op              )
200                              ),
201
202             TP_fast_assign(
203                     __entry->rxcall     = call->rxcall;
204                     __entry->call       = call;
205                     __entry->name       = call->type->name;
206                     __entry->op         = call->operation_ID;
207                            ),
208
209             TP_printk("c=%p ac=%p %s o=%u",
210                       __entry->rxcall,
211                       __entry->call,
212                       __entry->name,
213                       __entry->op)
214             );
215
216 TRACE_EVENT(afs_call,
217             TP_PROTO(struct afs_call *call, enum afs_call_trace op,
218                      int usage, int outstanding, const void *where),
219
220             TP_ARGS(call, op, usage, outstanding, where),
221
222             TP_STRUCT__entry(
223                     __field(struct afs_call *,          call            )
224                     __field(int,                        op              )
225                     __field(int,                        usage           )
226                     __field(int,                        outstanding     )
227                     __field(const void *,               where           )
228                              ),
229
230             TP_fast_assign(
231                     __entry->call = call;
232                     __entry->op = op;
233                     __entry->usage = usage;
234                     __entry->outstanding = outstanding;
235                     __entry->where = where;
236                            ),
237
238             TP_printk("c=%p %s u=%d o=%d sp=%pSR",
239                       __entry->call,
240                       __print_symbolic(__entry->op, afs_call_traces),
241                       __entry->usage,
242                       __entry->outstanding,
243                       __entry->where)
244             );
245
246 TRACE_EVENT(afs_make_fs_call,
247             TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
248
249             TP_ARGS(call, fid),
250
251             TP_STRUCT__entry(
252                     __field(struct afs_call *,          call            )
253                     __field(enum afs_fs_operation,      op              )
254                     __field_struct(struct afs_fid,      fid             )
255                              ),
256
257             TP_fast_assign(
258                     __entry->call = call;
259                     __entry->op = call->operation_ID;
260                     if (fid) {
261                             __entry->fid = *fid;
262                     } else {
263                             __entry->fid.vid = 0;
264                             __entry->fid.vnode = 0;
265                             __entry->fid.unique = 0;
266                     }
267                            ),
268
269             TP_printk("c=%p %06x:%06x:%06x %s",
270                       __entry->call,
271                       __entry->fid.vid,
272                       __entry->fid.vnode,
273                       __entry->fid.unique,
274                       __print_symbolic(__entry->op, afs_fs_operations))
275             );
276
277 TRACE_EVENT(afs_make_vl_call,
278             TP_PROTO(struct afs_call *call),
279
280             TP_ARGS(call),
281
282             TP_STRUCT__entry(
283                     __field(struct afs_call *,          call            )
284                     __field(enum afs_vl_operation,      op              )
285                              ),
286
287             TP_fast_assign(
288                     __entry->call = call;
289                     __entry->op = call->operation_ID;
290                            ),
291
292             TP_printk("c=%p %s",
293                       __entry->call,
294                       __print_symbolic(__entry->op, afs_vl_operations))
295             );
296
297 TRACE_EVENT(afs_call_done,
298             TP_PROTO(struct afs_call *call),
299
300             TP_ARGS(call),
301
302             TP_STRUCT__entry(
303                     __field(struct afs_call *,          call            )
304                     __field(struct rxrpc_call *,        rx_call         )
305                     __field(int,                        ret             )
306                     __field(u32,                        abort_code      )
307                              ),
308
309             TP_fast_assign(
310                     __entry->call = call;
311                     __entry->rx_call = call->rxcall;
312                     __entry->ret = call->error;
313                     __entry->abort_code = call->abort_code;
314                            ),
315
316             TP_printk("   c=%p ret=%d ab=%d [%p]",
317                       __entry->call,
318                       __entry->ret,
319                       __entry->abort_code,
320                       __entry->rx_call)
321             );
322
323 TRACE_EVENT(afs_send_pages,
324             TP_PROTO(struct afs_call *call, struct msghdr *msg,
325                      pgoff_t first, pgoff_t last, unsigned int offset),
326
327             TP_ARGS(call, msg, first, last, offset),
328
329             TP_STRUCT__entry(
330                     __field(struct afs_call *,          call            )
331                     __field(pgoff_t,                    first           )
332                     __field(pgoff_t,                    last            )
333                     __field(unsigned int,               nr              )
334                     __field(unsigned int,               bytes           )
335                     __field(unsigned int,               offset          )
336                     __field(unsigned int,               flags           )
337                              ),
338
339             TP_fast_assign(
340                     __entry->call = call;
341                     __entry->first = first;
342                     __entry->last = last;
343                     __entry->nr = msg->msg_iter.nr_segs;
344                     __entry->bytes = msg->msg_iter.count;
345                     __entry->offset = offset;
346                     __entry->flags = msg->msg_flags;
347                            ),
348
349             TP_printk(" c=%p %lx-%lx-%lx b=%x o=%x f=%x",
350                       __entry->call,
351                       __entry->first, __entry->first + __entry->nr - 1, __entry->last,
352                       __entry->bytes, __entry->offset,
353                       __entry->flags)
354             );
355
356 TRACE_EVENT(afs_sent_pages,
357             TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
358                      pgoff_t cursor, int ret),
359
360             TP_ARGS(call, first, last, cursor, ret),
361
362             TP_STRUCT__entry(
363                     __field(struct afs_call *,          call            )
364                     __field(pgoff_t,                    first           )
365                     __field(pgoff_t,                    last            )
366                     __field(pgoff_t,                    cursor          )
367                     __field(int,                        ret             )
368                              ),
369
370             TP_fast_assign(
371                     __entry->call = call;
372                     __entry->first = first;
373                     __entry->last = last;
374                     __entry->cursor = cursor;
375                     __entry->ret = ret;
376                            ),
377
378             TP_printk(" c=%p %lx-%lx c=%lx r=%d",
379                       __entry->call,
380                       __entry->first, __entry->last,
381                       __entry->cursor, __entry->ret)
382             );
383
384 TRACE_EVENT(afs_dir_check_failed,
385             TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
386
387             TP_ARGS(vnode, off, i_size),
388
389             TP_STRUCT__entry(
390                     __field(struct afs_vnode *,         vnode           )
391                     __field(loff_t,                     off             )
392                     __field(loff_t,                     i_size          )
393                              ),
394
395             TP_fast_assign(
396                     __entry->vnode = vnode;
397                     __entry->off = off;
398                     __entry->i_size = i_size;
399                            ),
400
401             TP_printk("vn=%p %llx/%llx",
402                       __entry->vnode, __entry->off, __entry->i_size)
403             );
404
405 /*
406  * We use page->private to hold the amount of the page that we've written to,
407  * splitting the field into two parts.  However, we need to represent a range
408  * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
409  */
410 #if PAGE_SIZE > 32768
411 #define AFS_PRIV_MAX    0xffffffff
412 #define AFS_PRIV_SHIFT  32
413 #else
414 #define AFS_PRIV_MAX    0xffff
415 #define AFS_PRIV_SHIFT  16
416 #endif
417
418 TRACE_EVENT(afs_page_dirty,
419             TP_PROTO(struct afs_vnode *vnode, const char *where,
420                      pgoff_t page, unsigned long priv),
421
422             TP_ARGS(vnode, where, page, priv),
423
424             TP_STRUCT__entry(
425                     __field(struct afs_vnode *,         vnode           )
426                     __field(const char *,               where           )
427                     __field(pgoff_t,                    page            )
428                     __field(unsigned long,              priv            )
429                              ),
430
431             TP_fast_assign(
432                     __entry->vnode = vnode;
433                     __entry->where = where;
434                     __entry->page = page;
435                     __entry->priv = priv;
436                            ),
437
438             TP_printk("vn=%p %lx %s %lu-%lu",
439                       __entry->vnode, __entry->page, __entry->where,
440                       __entry->priv & AFS_PRIV_MAX,
441                       __entry->priv >> AFS_PRIV_SHIFT)
442             );
443
444 TRACE_EVENT(afs_call_state,
445             TP_PROTO(struct afs_call *call,
446                      enum afs_call_state from,
447                      enum afs_call_state to,
448                      int ret, u32 remote_abort),
449
450             TP_ARGS(call, from, to, ret, remote_abort),
451
452             TP_STRUCT__entry(
453                     __field(struct afs_call *,          call            )
454                     __field(enum afs_call_state,        from            )
455                     __field(enum afs_call_state,        to              )
456                     __field(int,                        ret             )
457                     __field(u32,                        abort           )
458                              ),
459
460             TP_fast_assign(
461                     __entry->call = call;
462                     __entry->from = from;
463                     __entry->to = to;
464                     __entry->ret = ret;
465                     __entry->abort = remote_abort;
466                            ),
467
468             TP_printk("c=%p %u->%u r=%d ab=%d",
469                       __entry->call,
470                       __entry->from, __entry->to,
471                       __entry->ret, __entry->abort)
472             );
473
474 #endif /* _TRACE_AFS_H */
475
476 /* This part must be outside protection */
477 #include <trace/define_trace.h>