8acd56e20a371f09856743e3538550e78b18ea0b
[sfrench/cifs-2.6.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_InlineBulkStatus         = 65536, /* AFS Fetch multiple file statuses with errors */
53         afs_FS_FetchData64              = 65537, /* AFS Fetch file data */
54         afs_FS_StoreData64              = 65538, /* AFS Store file data */
55         afs_FS_GiveUpAllCallBacks       = 65539, /* AFS Give up all our callbacks on a server */
56         afs_FS_GetCapabilities          = 65540, /* AFS Get FS server capabilities */
57 };
58
59 enum afs_vl_operation {
60         afs_VL_GetEntryByNameU  = 527,          /* AFS Get Vol Entry By Name operation ID */
61         afs_VL_GetAddrsU        = 533,          /* AFS Get FS server addresses */
62         afs_YFSVL_GetEndpoints  = 64002,        /* YFS Get FS & Vol server addresses */
63         afs_VL_GetCapabilities  = 65537,        /* AFS Get VL server capabilities */
64 };
65
66 enum afs_edit_dir_op {
67         afs_edit_dir_create,
68         afs_edit_dir_create_error,
69         afs_edit_dir_create_inval,
70         afs_edit_dir_create_nospc,
71         afs_edit_dir_delete,
72         afs_edit_dir_delete_error,
73         afs_edit_dir_delete_inval,
74         afs_edit_dir_delete_noent,
75 };
76
77 enum afs_edit_dir_reason {
78         afs_edit_dir_for_create,
79         afs_edit_dir_for_link,
80         afs_edit_dir_for_mkdir,
81         afs_edit_dir_for_rename,
82         afs_edit_dir_for_rmdir,
83         afs_edit_dir_for_symlink,
84         afs_edit_dir_for_unlink,
85 };
86
87 enum afs_eproto_cause {
88         afs_eproto_bad_status,
89         afs_eproto_cb_count,
90         afs_eproto_cb_fid_count,
91         afs_eproto_file_type,
92         afs_eproto_ibulkst_cb_count,
93         afs_eproto_ibulkst_count,
94         afs_eproto_motd_len,
95         afs_eproto_offline_msg_len,
96         afs_eproto_volname_len,
97         afs_eproto_yvl_fsendpt4_len,
98         afs_eproto_yvl_fsendpt6_len,
99         afs_eproto_yvl_fsendpt_num,
100         afs_eproto_yvl_fsendpt_type,
101         afs_eproto_yvl_vlendpt4_len,
102         afs_eproto_yvl_vlendpt6_len,
103         afs_eproto_yvl_vlendpt_type,
104 };
105
106 enum afs_io_error {
107         afs_io_error_cm_reply,
108         afs_io_error_extract,
109         afs_io_error_fs_probe_fail,
110         afs_io_error_vl_lookup_fail,
111 };
112
113 enum afs_file_error {
114         afs_file_error_dir_bad_magic,
115         afs_file_error_dir_big,
116         afs_file_error_dir_missing_page,
117         afs_file_error_dir_over_end,
118         afs_file_error_dir_small,
119         afs_file_error_dir_unmarked_ext,
120         afs_file_error_mntpt,
121         afs_file_error_writeback_fail,
122 };
123
124 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
125
126 /*
127  * Declare tracing information enums and their string mappings for display.
128  */
129 #define afs_call_traces \
130         EM(afs_call_trace_alloc,                "ALLOC") \
131         EM(afs_call_trace_free,                 "FREE ") \
132         EM(afs_call_trace_put,                  "PUT  ") \
133         EM(afs_call_trace_wake,                 "WAKE ") \
134         E_(afs_call_trace_work,                 "WORK ")
135
136 #define afs_fs_operations \
137         EM(afs_FS_FetchData,                    "FS.FetchData") \
138         EM(afs_FS_FetchStatus,                  "FS.FetchStatus") \
139         EM(afs_FS_StoreData,                    "FS.StoreData") \
140         EM(afs_FS_StoreStatus,                  "FS.StoreStatus") \
141         EM(afs_FS_RemoveFile,                   "FS.RemoveFile") \
142         EM(afs_FS_CreateFile,                   "FS.CreateFile") \
143         EM(afs_FS_Rename,                       "FS.Rename") \
144         EM(afs_FS_Symlink,                      "FS.Symlink") \
145         EM(afs_FS_Link,                         "FS.Link") \
146         EM(afs_FS_MakeDir,                      "FS.MakeDir") \
147         EM(afs_FS_RemoveDir,                    "FS.RemoveDir") \
148         EM(afs_FS_GetVolumeInfo,                "FS.GetVolumeInfo") \
149         EM(afs_FS_GetVolumeStatus,              "FS.GetVolumeStatus") \
150         EM(afs_FS_GetRootVolume,                "FS.GetRootVolume") \
151         EM(afs_FS_SetLock,                      "FS.SetLock") \
152         EM(afs_FS_ExtendLock,                   "FS.ExtendLock") \
153         EM(afs_FS_ReleaseLock,                  "FS.ReleaseLock") \
154         EM(afs_FS_Lookup,                       "FS.Lookup") \
155         EM(afs_FS_InlineBulkStatus,             "FS.InlineBulkStatus") \
156         EM(afs_FS_FetchData64,                  "FS.FetchData64") \
157         EM(afs_FS_StoreData64,                  "FS.StoreData64") \
158         EM(afs_FS_GiveUpAllCallBacks,           "FS.GiveUpAllCallBacks") \
159         E_(afs_FS_GetCapabilities,              "FS.GetCapabilities")
160
161 #define afs_vl_operations \
162         EM(afs_VL_GetEntryByNameU,              "VL.GetEntryByNameU") \
163         EM(afs_VL_GetAddrsU,                    "VL.GetAddrsU") \
164         EM(afs_YFSVL_GetEndpoints,              "YFSVL.GetEndpoints") \
165         E_(afs_VL_GetCapabilities,              "VL.GetCapabilities")
166
167 #define afs_edit_dir_ops                                  \
168         EM(afs_edit_dir_create,                 "create") \
169         EM(afs_edit_dir_create_error,           "c_fail") \
170         EM(afs_edit_dir_create_inval,           "c_invl") \
171         EM(afs_edit_dir_create_nospc,           "c_nspc") \
172         EM(afs_edit_dir_delete,                 "delete") \
173         EM(afs_edit_dir_delete_error,           "d_err ") \
174         EM(afs_edit_dir_delete_inval,           "d_invl") \
175         E_(afs_edit_dir_delete_noent,           "d_nent")
176
177 #define afs_edit_dir_reasons                              \
178         EM(afs_edit_dir_for_create,             "Create") \
179         EM(afs_edit_dir_for_link,               "Link  ") \
180         EM(afs_edit_dir_for_mkdir,              "MkDir ") \
181         EM(afs_edit_dir_for_rename,             "Rename") \
182         EM(afs_edit_dir_for_rmdir,              "RmDir ") \
183         EM(afs_edit_dir_for_symlink,            "Symlnk") \
184         E_(afs_edit_dir_for_unlink,             "Unlink")
185
186 #define afs_eproto_causes                       \
187         EM(afs_eproto_bad_status,       "BadStatus") \
188         EM(afs_eproto_cb_count,         "CbCount") \
189         EM(afs_eproto_cb_fid_count,     "CbFidCount") \
190         EM(afs_eproto_file_type,        "FileTYpe") \
191         EM(afs_eproto_ibulkst_cb_count, "IBS.CbCount") \
192         EM(afs_eproto_ibulkst_count,    "IBS.FidCount") \
193         EM(afs_eproto_motd_len,         "MotdLen") \
194         EM(afs_eproto_offline_msg_len,  "OfflineMsgLen") \
195         EM(afs_eproto_volname_len,      "VolNameLen") \
196         EM(afs_eproto_yvl_fsendpt4_len, "YVL.FsEnd4Len") \
197         EM(afs_eproto_yvl_fsendpt6_len, "YVL.FsEnd6Len") \
198         EM(afs_eproto_yvl_fsendpt_num,  "YVL.FsEndCount") \
199         EM(afs_eproto_yvl_fsendpt_type, "YVL.FsEndType") \
200         EM(afs_eproto_yvl_vlendpt4_len, "YVL.VlEnd4Len") \
201         EM(afs_eproto_yvl_vlendpt6_len, "YVL.VlEnd6Len") \
202         E_(afs_eproto_yvl_vlendpt_type, "YVL.VlEndType")
203
204 #define afs_io_errors                                                   \
205         EM(afs_io_error_cm_reply,               "CM_REPLY")             \
206         EM(afs_io_error_extract,                "EXTRACT")              \
207         EM(afs_io_error_fs_probe_fail,          "FS_PROBE_FAIL")        \
208         E_(afs_io_error_vl_lookup_fail,         "VL_LOOKUP_FAIL")
209
210 #define afs_file_errors                                                 \
211         EM(afs_file_error_dir_bad_magic,        "DIR_BAD_MAGIC")        \
212         EM(afs_file_error_dir_big,              "DIR_BIG")              \
213         EM(afs_file_error_dir_missing_page,     "DIR_MISSING_PAGE")     \
214         EM(afs_file_error_dir_over_end,         "DIR_ENT_OVER_END")     \
215         EM(afs_file_error_dir_small,            "DIR_SMALL")            \
216         EM(afs_file_error_dir_unmarked_ext,     "DIR_UNMARKED_EXT")     \
217         EM(afs_file_error_mntpt,                "MNTPT_READ_FAILED")    \
218         E_(afs_file_error_writeback_fail,       "WRITEBACK_FAILED")
219
220 /*
221  * Export enum symbols via userspace.
222  */
223 #undef EM
224 #undef E_
225 #define EM(a, b) TRACE_DEFINE_ENUM(a);
226 #define E_(a, b) TRACE_DEFINE_ENUM(a);
227
228 afs_call_traces;
229 afs_fs_operations;
230 afs_vl_operations;
231 afs_edit_dir_ops;
232 afs_edit_dir_reasons;
233 afs_eproto_causes;
234 afs_io_errors;
235 afs_file_errors;
236
237 /*
238  * Now redefine the EM() and E_() macros to map the enums to the strings that
239  * will be printed in the output.
240  */
241 #undef EM
242 #undef E_
243 #define EM(a, b)        { a, b },
244 #define E_(a, b)        { a, b }
245
246 TRACE_EVENT(afs_receive_data,
247             TP_PROTO(struct afs_call *call, struct iov_iter *iter,
248                      bool want_more, int ret),
249
250             TP_ARGS(call, iter, want_more, ret),
251
252             TP_STRUCT__entry(
253                     __field(loff_t,                     remain          )
254                     __field(unsigned int,               call            )
255                     __field(enum afs_call_state,        state           )
256                     __field(unsigned short,             unmarshall      )
257                     __field(bool,                       want_more       )
258                     __field(int,                        ret             )
259                              ),
260
261             TP_fast_assign(
262                     __entry->call       = call->debug_id;
263                     __entry->state      = call->state;
264                     __entry->unmarshall = call->unmarshall;
265                     __entry->remain     = iov_iter_count(iter);
266                     __entry->want_more  = want_more;
267                     __entry->ret        = ret;
268                            ),
269
270             TP_printk("c=%08x r=%llu u=%u w=%u s=%u ret=%d",
271                       __entry->call,
272                       __entry->remain,
273                       __entry->unmarshall,
274                       __entry->want_more,
275                       __entry->state,
276                       __entry->ret)
277             );
278
279 TRACE_EVENT(afs_notify_call,
280             TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
281
282             TP_ARGS(rxcall, call),
283
284             TP_STRUCT__entry(
285                     __field(unsigned int,               call            )
286                     __field(enum afs_call_state,        state           )
287                     __field(unsigned short,             unmarshall      )
288                              ),
289
290             TP_fast_assign(
291                     __entry->call       = call->debug_id;
292                     __entry->state      = call->state;
293                     __entry->unmarshall = call->unmarshall;
294                            ),
295
296             TP_printk("c=%08x s=%u u=%u",
297                       __entry->call,
298                       __entry->state, __entry->unmarshall)
299             );
300
301 TRACE_EVENT(afs_cb_call,
302             TP_PROTO(struct afs_call *call),
303
304             TP_ARGS(call),
305
306             TP_STRUCT__entry(
307                     __field(unsigned int,               call            )
308                     __field(const char *,               name            )
309                     __field(u32,                        op              )
310                              ),
311
312             TP_fast_assign(
313                     __entry->call       = call->debug_id;
314                     __entry->name       = call->type->name;
315                     __entry->op         = call->operation_ID;
316                            ),
317
318             TP_printk("c=%08x %s o=%u",
319                       __entry->call,
320                       __entry->name,
321                       __entry->op)
322             );
323
324 TRACE_EVENT(afs_call,
325             TP_PROTO(struct afs_call *call, enum afs_call_trace op,
326                      int usage, int outstanding, const void *where),
327
328             TP_ARGS(call, op, usage, outstanding, where),
329
330             TP_STRUCT__entry(
331                     __field(unsigned int,               call            )
332                     __field(int,                        op              )
333                     __field(int,                        usage           )
334                     __field(int,                        outstanding     )
335                     __field(const void *,               where           )
336                              ),
337
338             TP_fast_assign(
339                     __entry->call = call->debug_id;
340                     __entry->op = op;
341                     __entry->usage = usage;
342                     __entry->outstanding = outstanding;
343                     __entry->where = where;
344                            ),
345
346             TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
347                       __entry->call,
348                       __print_symbolic(__entry->op, afs_call_traces),
349                       __entry->usage,
350                       __entry->outstanding,
351                       __entry->where)
352             );
353
354 TRACE_EVENT(afs_make_fs_call,
355             TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
356
357             TP_ARGS(call, fid),
358
359             TP_STRUCT__entry(
360                     __field(unsigned int,               call            )
361                     __field(enum afs_fs_operation,      op              )
362                     __field_struct(struct afs_fid,      fid             )
363                              ),
364
365             TP_fast_assign(
366                     __entry->call = call->debug_id;
367                     __entry->op = call->operation_ID;
368                     if (fid) {
369                             __entry->fid = *fid;
370                     } else {
371                             __entry->fid.vid = 0;
372                             __entry->fid.vnode = 0;
373                             __entry->fid.unique = 0;
374                     }
375                            ),
376
377             TP_printk("c=%08x %06llx:%06llx:%06x %s",
378                       __entry->call,
379                       __entry->fid.vid,
380                       __entry->fid.vnode,
381                       __entry->fid.unique,
382                       __print_symbolic(__entry->op, afs_fs_operations))
383             );
384
385 TRACE_EVENT(afs_make_vl_call,
386             TP_PROTO(struct afs_call *call),
387
388             TP_ARGS(call),
389
390             TP_STRUCT__entry(
391                     __field(unsigned int,               call            )
392                     __field(enum afs_vl_operation,      op              )
393                              ),
394
395             TP_fast_assign(
396                     __entry->call = call->debug_id;
397                     __entry->op = call->operation_ID;
398                            ),
399
400             TP_printk("c=%08x %s",
401                       __entry->call,
402                       __print_symbolic(__entry->op, afs_vl_operations))
403             );
404
405 TRACE_EVENT(afs_call_done,
406             TP_PROTO(struct afs_call *call),
407
408             TP_ARGS(call),
409
410             TP_STRUCT__entry(
411                     __field(unsigned int,               call            )
412                     __field(struct rxrpc_call *,        rx_call         )
413                     __field(int,                        ret             )
414                     __field(u32,                        abort_code      )
415                              ),
416
417             TP_fast_assign(
418                     __entry->call = call->debug_id;
419                     __entry->rx_call = call->rxcall;
420                     __entry->ret = call->error;
421                     __entry->abort_code = call->abort_code;
422                            ),
423
424             TP_printk("   c=%08x ret=%d ab=%d [%p]",
425                       __entry->call,
426                       __entry->ret,
427                       __entry->abort_code,
428                       __entry->rx_call)
429             );
430
431 TRACE_EVENT(afs_send_pages,
432             TP_PROTO(struct afs_call *call, struct msghdr *msg,
433                      pgoff_t first, pgoff_t last, unsigned int offset),
434
435             TP_ARGS(call, msg, first, last, offset),
436
437             TP_STRUCT__entry(
438                     __field(unsigned int,               call            )
439                     __field(pgoff_t,                    first           )
440                     __field(pgoff_t,                    last            )
441                     __field(unsigned int,               nr              )
442                     __field(unsigned int,               bytes           )
443                     __field(unsigned int,               offset          )
444                     __field(unsigned int,               flags           )
445                              ),
446
447             TP_fast_assign(
448                     __entry->call = call->debug_id;
449                     __entry->first = first;
450                     __entry->last = last;
451                     __entry->nr = msg->msg_iter.nr_segs;
452                     __entry->bytes = msg->msg_iter.count;
453                     __entry->offset = offset;
454                     __entry->flags = msg->msg_flags;
455                            ),
456
457             TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
458                       __entry->call,
459                       __entry->first, __entry->first + __entry->nr - 1, __entry->last,
460                       __entry->bytes, __entry->offset,
461                       __entry->flags)
462             );
463
464 TRACE_EVENT(afs_sent_pages,
465             TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
466                      pgoff_t cursor, int ret),
467
468             TP_ARGS(call, first, last, cursor, ret),
469
470             TP_STRUCT__entry(
471                     __field(unsigned int,               call            )
472                     __field(pgoff_t,                    first           )
473                     __field(pgoff_t,                    last            )
474                     __field(pgoff_t,                    cursor          )
475                     __field(int,                        ret             )
476                              ),
477
478             TP_fast_assign(
479                     __entry->call = call->debug_id;
480                     __entry->first = first;
481                     __entry->last = last;
482                     __entry->cursor = cursor;
483                     __entry->ret = ret;
484                            ),
485
486             TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
487                       __entry->call,
488                       __entry->first, __entry->last,
489                       __entry->cursor, __entry->ret)
490             );
491
492 TRACE_EVENT(afs_dir_check_failed,
493             TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
494
495             TP_ARGS(vnode, off, i_size),
496
497             TP_STRUCT__entry(
498                     __field(struct afs_vnode *,         vnode           )
499                     __field(loff_t,                     off             )
500                     __field(loff_t,                     i_size          )
501                              ),
502
503             TP_fast_assign(
504                     __entry->vnode = vnode;
505                     __entry->off = off;
506                     __entry->i_size = i_size;
507                            ),
508
509             TP_printk("vn=%p %llx/%llx",
510                       __entry->vnode, __entry->off, __entry->i_size)
511             );
512
513 /*
514  * We use page->private to hold the amount of the page that we've written to,
515  * splitting the field into two parts.  However, we need to represent a range
516  * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
517  */
518 #if PAGE_SIZE > 32768
519 #define AFS_PRIV_MAX    0xffffffff
520 #define AFS_PRIV_SHIFT  32
521 #else
522 #define AFS_PRIV_MAX    0xffff
523 #define AFS_PRIV_SHIFT  16
524 #endif
525
526 TRACE_EVENT(afs_page_dirty,
527             TP_PROTO(struct afs_vnode *vnode, const char *where,
528                      pgoff_t page, unsigned long priv),
529
530             TP_ARGS(vnode, where, page, priv),
531
532             TP_STRUCT__entry(
533                     __field(struct afs_vnode *,         vnode           )
534                     __field(const char *,               where           )
535                     __field(pgoff_t,                    page            )
536                     __field(unsigned long,              priv            )
537                              ),
538
539             TP_fast_assign(
540                     __entry->vnode = vnode;
541                     __entry->where = where;
542                     __entry->page = page;
543                     __entry->priv = priv;
544                            ),
545
546             TP_printk("vn=%p %lx %s %lu-%lu",
547                       __entry->vnode, __entry->page, __entry->where,
548                       __entry->priv & AFS_PRIV_MAX,
549                       __entry->priv >> AFS_PRIV_SHIFT)
550             );
551
552 TRACE_EVENT(afs_call_state,
553             TP_PROTO(struct afs_call *call,
554                      enum afs_call_state from,
555                      enum afs_call_state to,
556                      int ret, u32 remote_abort),
557
558             TP_ARGS(call, from, to, ret, remote_abort),
559
560             TP_STRUCT__entry(
561                     __field(unsigned int,               call            )
562                     __field(enum afs_call_state,        from            )
563                     __field(enum afs_call_state,        to              )
564                     __field(int,                        ret             )
565                     __field(u32,                        abort           )
566                              ),
567
568             TP_fast_assign(
569                     __entry->call = call->debug_id;
570                     __entry->from = from;
571                     __entry->to = to;
572                     __entry->ret = ret;
573                     __entry->abort = remote_abort;
574                            ),
575
576             TP_printk("c=%08x %u->%u r=%d ab=%d",
577                       __entry->call,
578                       __entry->from, __entry->to,
579                       __entry->ret, __entry->abort)
580             );
581
582 TRACE_EVENT(afs_edit_dir,
583             TP_PROTO(struct afs_vnode *dvnode,
584                      enum afs_edit_dir_reason why,
585                      enum afs_edit_dir_op op,
586                      unsigned int block,
587                      unsigned int slot,
588                      unsigned int f_vnode,
589                      unsigned int f_unique,
590                      const char *name),
591
592             TP_ARGS(dvnode, why, op, block, slot, f_vnode, f_unique, name),
593
594             TP_STRUCT__entry(
595                     __field(unsigned int,               vnode           )
596                     __field(unsigned int,               unique          )
597                     __field(enum afs_edit_dir_reason,   why             )
598                     __field(enum afs_edit_dir_op,       op              )
599                     __field(unsigned int,               block           )
600                     __field(unsigned short,             slot            )
601                     __field(unsigned int,               f_vnode         )
602                     __field(unsigned int,               f_unique        )
603                     __array(char,                       name, 18        )
604                              ),
605
606             TP_fast_assign(
607                     int __len = strlen(name);
608                     __len = min(__len, 17);
609                     __entry->vnode      = dvnode->fid.vnode;
610                     __entry->unique     = dvnode->fid.unique;
611                     __entry->why        = why;
612                     __entry->op         = op;
613                     __entry->block      = block;
614                     __entry->slot       = slot;
615                     __entry->f_vnode    = f_vnode;
616                     __entry->f_unique   = f_unique;
617                     memcpy(__entry->name, name, __len);
618                     __entry->name[__len] = 0;
619                            ),
620
621             TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x %s",
622                       __entry->vnode, __entry->unique,
623                       __print_symbolic(__entry->why, afs_edit_dir_reasons),
624                       __print_symbolic(__entry->op, afs_edit_dir_ops),
625                       __entry->block, __entry->slot,
626                       __entry->f_vnode, __entry->f_unique,
627                       __entry->name)
628             );
629
630 TRACE_EVENT(afs_protocol_error,
631             TP_PROTO(struct afs_call *call, int error, enum afs_eproto_cause cause),
632
633             TP_ARGS(call, error, cause),
634
635             TP_STRUCT__entry(
636                     __field(unsigned int,               call            )
637                     __field(int,                        error           )
638                     __field(enum afs_eproto_cause,      cause           )
639                              ),
640
641             TP_fast_assign(
642                     __entry->call = call ? call->debug_id : 0;
643                     __entry->error = error;
644                     __entry->cause = cause;
645                            ),
646
647             TP_printk("c=%08x r=%d %s",
648                       __entry->call, __entry->error,
649                       __print_symbolic(__entry->cause, afs_eproto_causes))
650             );
651
652 TRACE_EVENT(afs_io_error,
653             TP_PROTO(unsigned int call, int error, enum afs_io_error where),
654
655             TP_ARGS(call, error, where),
656
657             TP_STRUCT__entry(
658                     __field(unsigned int,       call            )
659                     __field(int,                error           )
660                     __field(enum afs_io_error,  where           )
661                              ),
662
663             TP_fast_assign(
664                     __entry->call = call;
665                     __entry->error = error;
666                     __entry->where = where;
667                            ),
668
669             TP_printk("c=%08x r=%d %s",
670                       __entry->call, __entry->error,
671                       __print_symbolic(__entry->where, afs_io_errors))
672             );
673
674 TRACE_EVENT(afs_file_error,
675             TP_PROTO(struct afs_vnode *vnode, int error, enum afs_file_error where),
676
677             TP_ARGS(vnode, error, where),
678
679             TP_STRUCT__entry(
680                     __field_struct(struct afs_fid,      fid             )
681                     __field(int,                        error           )
682                     __field(enum afs_file_error,        where           )
683                              ),
684
685             TP_fast_assign(
686                     __entry->fid = vnode->fid;
687                     __entry->error = error;
688                     __entry->where = where;
689                            ),
690
691             TP_printk("%llx:%llx:%x r=%d %s",
692                       __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
693                       __entry->error,
694                       __print_symbolic(__entry->where, afs_file_errors))
695             );
696
697 TRACE_EVENT(afs_cm_no_server,
698             TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx),
699
700             TP_ARGS(call, srx),
701
702             TP_STRUCT__entry(
703                     __field(unsigned int,                       call    )
704                     __field(unsigned int,                       op_id   )
705                     __field_struct(struct sockaddr_rxrpc,       srx     )
706                              ),
707
708             TP_fast_assign(
709                     __entry->call = call->debug_id;
710                     __entry->op_id = call->operation_ID;
711                     memcpy(&__entry->srx, srx, sizeof(__entry->srx));
712                            ),
713
714             TP_printk("c=%08x op=%u %pISpc",
715                       __entry->call, __entry->op_id, &__entry->srx.transport)
716             );
717
718 TRACE_EVENT(afs_cm_no_server_u,
719             TP_PROTO(struct afs_call *call, const uuid_t *uuid),
720
721             TP_ARGS(call, uuid),
722
723             TP_STRUCT__entry(
724                     __field(unsigned int,                       call    )
725                     __field(unsigned int,                       op_id   )
726                     __field_struct(uuid_t,                      uuid    )
727                              ),
728
729             TP_fast_assign(
730                     __entry->call = call->debug_id;
731                     __entry->op_id = call->operation_ID;
732                     memcpy(&__entry->uuid, uuid, sizeof(__entry->uuid));
733                            ),
734
735             TP_printk("c=%08x op=%u %pU",
736                       __entry->call, __entry->op_id, &__entry->uuid)
737             );
738
739 #endif /* _TRACE_AFS_H */
740
741 /* This part must be outside protection */
742 #include <trace/define_trace.h>