3 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
12 #define TRACE_SYSTEM afs
14 #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ)
17 #include <linux/tracepoint.h>
20 * Define enums for tracing information.
22 #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
23 #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
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 */
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 */
66 enum afs_edit_dir_op {
68 afs_edit_dir_create_error,
69 afs_edit_dir_create_inval,
70 afs_edit_dir_create_nospc,
72 afs_edit_dir_delete_error,
73 afs_edit_dir_delete_inval,
74 afs_edit_dir_delete_noent,
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,
87 enum afs_eproto_cause {
88 afs_eproto_bad_status,
90 afs_eproto_cb_fid_count,
92 afs_eproto_ibulkst_cb_count,
93 afs_eproto_ibulkst_count,
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,
106 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
109 * Declare tracing information enums and their string mappings for display.
111 #define afs_call_traces \
112 EM(afs_call_trace_alloc, "ALLOC") \
113 EM(afs_call_trace_free, "FREE ") \
114 EM(afs_call_trace_put, "PUT ") \
115 EM(afs_call_trace_wake, "WAKE ") \
116 E_(afs_call_trace_work, "WORK ")
118 #define afs_fs_operations \
119 EM(afs_FS_FetchData, "FS.FetchData") \
120 EM(afs_FS_FetchStatus, "FS.FetchStatus") \
121 EM(afs_FS_StoreData, "FS.StoreData") \
122 EM(afs_FS_StoreStatus, "FS.StoreStatus") \
123 EM(afs_FS_RemoveFile, "FS.RemoveFile") \
124 EM(afs_FS_CreateFile, "FS.CreateFile") \
125 EM(afs_FS_Rename, "FS.Rename") \
126 EM(afs_FS_Symlink, "FS.Symlink") \
127 EM(afs_FS_Link, "FS.Link") \
128 EM(afs_FS_MakeDir, "FS.MakeDir") \
129 EM(afs_FS_RemoveDir, "FS.RemoveDir") \
130 EM(afs_FS_GetVolumeInfo, "FS.GetVolumeInfo") \
131 EM(afs_FS_GetVolumeStatus, "FS.GetVolumeStatus") \
132 EM(afs_FS_GetRootVolume, "FS.GetRootVolume") \
133 EM(afs_FS_SetLock, "FS.SetLock") \
134 EM(afs_FS_ExtendLock, "FS.ExtendLock") \
135 EM(afs_FS_ReleaseLock, "FS.ReleaseLock") \
136 EM(afs_FS_Lookup, "FS.Lookup") \
137 EM(afs_FS_InlineBulkStatus, "FS.InlineBulkStatus") \
138 EM(afs_FS_FetchData64, "FS.FetchData64") \
139 EM(afs_FS_StoreData64, "FS.StoreData64") \
140 EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \
141 E_(afs_FS_GetCapabilities, "FS.GetCapabilities")
143 #define afs_vl_operations \
144 EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \
145 EM(afs_VL_GetAddrsU, "VL.GetAddrsU") \
146 EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \
147 E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
149 #define afs_edit_dir_ops \
150 EM(afs_edit_dir_create, "create") \
151 EM(afs_edit_dir_create_error, "c_fail") \
152 EM(afs_edit_dir_create_inval, "c_invl") \
153 EM(afs_edit_dir_create_nospc, "c_nspc") \
154 EM(afs_edit_dir_delete, "delete") \
155 EM(afs_edit_dir_delete_error, "d_err ") \
156 EM(afs_edit_dir_delete_inval, "d_invl") \
157 E_(afs_edit_dir_delete_noent, "d_nent")
159 #define afs_edit_dir_reasons \
160 EM(afs_edit_dir_for_create, "Create") \
161 EM(afs_edit_dir_for_link, "Link ") \
162 EM(afs_edit_dir_for_mkdir, "MkDir ") \
163 EM(afs_edit_dir_for_rename, "Rename") \
164 EM(afs_edit_dir_for_rmdir, "RmDir ") \
165 EM(afs_edit_dir_for_symlink, "Symlnk") \
166 E_(afs_edit_dir_for_unlink, "Unlink")
168 #define afs_eproto_causes \
169 EM(afs_eproto_bad_status, "BadStatus") \
170 EM(afs_eproto_cb_count, "CbCount") \
171 EM(afs_eproto_cb_fid_count, "CbFidCount") \
172 EM(afs_eproto_file_type, "FileTYpe") \
173 EM(afs_eproto_ibulkst_cb_count, "IBS.CbCount") \
174 EM(afs_eproto_ibulkst_count, "IBS.FidCount") \
175 EM(afs_eproto_motd_len, "MotdLen") \
176 EM(afs_eproto_offline_msg_len, "OfflineMsgLen") \
177 EM(afs_eproto_volname_len, "VolNameLen") \
178 EM(afs_eproto_yvl_fsendpt4_len, "YVL.FsEnd4Len") \
179 EM(afs_eproto_yvl_fsendpt6_len, "YVL.FsEnd6Len") \
180 EM(afs_eproto_yvl_fsendpt_num, "YVL.FsEndCount") \
181 EM(afs_eproto_yvl_fsendpt_type, "YVL.FsEndType") \
182 EM(afs_eproto_yvl_vlendpt4_len, "YVL.VlEnd4Len") \
183 EM(afs_eproto_yvl_vlendpt6_len, "YVL.VlEnd6Len") \
184 E_(afs_eproto_yvl_vlendpt_type, "YVL.VlEndType")
188 * Export enum symbols via userspace.
192 #define EM(a, b) TRACE_DEFINE_ENUM(a);
193 #define E_(a, b) TRACE_DEFINE_ENUM(a);
199 afs_edit_dir_reasons;
202 * Now redefine the EM() and E_() macros to map the enums to the strings that
203 * will be printed in the output.
207 #define EM(a, b) { a, b },
208 #define E_(a, b) { a, b }
210 TRACE_EVENT(afs_receive_data,
211 TP_PROTO(struct afs_call *call, struct iov_iter *iter,
212 bool want_more, int ret),
214 TP_ARGS(call, iter, want_more, ret),
217 __field(loff_t, remain )
218 __field(unsigned int, call )
219 __field(enum afs_call_state, state )
220 __field(unsigned short, unmarshall )
221 __field(bool, want_more )
226 __entry->call = call->debug_id;
227 __entry->state = call->state;
228 __entry->unmarshall = call->unmarshall;
229 __entry->remain = iov_iter_count(iter);
230 __entry->want_more = want_more;
234 TP_printk("c=%08x r=%llu u=%u w=%u s=%u ret=%d",
243 TRACE_EVENT(afs_notify_call,
244 TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
246 TP_ARGS(rxcall, call),
249 __field(unsigned int, call )
250 __field(enum afs_call_state, state )
251 __field(unsigned short, unmarshall )
255 __entry->call = call->debug_id;
256 __entry->state = call->state;
257 __entry->unmarshall = call->unmarshall;
260 TP_printk("c=%08x s=%u u=%u",
262 __entry->state, __entry->unmarshall)
265 TRACE_EVENT(afs_cb_call,
266 TP_PROTO(struct afs_call *call),
271 __field(unsigned int, call )
272 __field(const char *, name )
277 __entry->call = call->debug_id;
278 __entry->name = call->type->name;
279 __entry->op = call->operation_ID;
282 TP_printk("c=%08x %s o=%u",
288 TRACE_EVENT(afs_call,
289 TP_PROTO(struct afs_call *call, enum afs_call_trace op,
290 int usage, int outstanding, const void *where),
292 TP_ARGS(call, op, usage, outstanding, where),
295 __field(unsigned int, call )
298 __field(int, outstanding )
299 __field(const void *, where )
303 __entry->call = call->debug_id;
305 __entry->usage = usage;
306 __entry->outstanding = outstanding;
307 __entry->where = where;
310 TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
312 __print_symbolic(__entry->op, afs_call_traces),
314 __entry->outstanding,
318 TRACE_EVENT(afs_make_fs_call,
319 TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
324 __field(unsigned int, call )
325 __field(enum afs_fs_operation, op )
326 __field_struct(struct afs_fid, fid )
330 __entry->call = call->debug_id;
331 __entry->op = call->operation_ID;
335 __entry->fid.vid = 0;
336 __entry->fid.vnode = 0;
337 __entry->fid.unique = 0;
341 TP_printk("c=%08x %06x:%06x:%06x %s",
346 __print_symbolic(__entry->op, afs_fs_operations))
349 TRACE_EVENT(afs_make_vl_call,
350 TP_PROTO(struct afs_call *call),
355 __field(unsigned int, call )
356 __field(enum afs_vl_operation, op )
360 __entry->call = call->debug_id;
361 __entry->op = call->operation_ID;
364 TP_printk("c=%08x %s",
366 __print_symbolic(__entry->op, afs_vl_operations))
369 TRACE_EVENT(afs_call_done,
370 TP_PROTO(struct afs_call *call),
375 __field(unsigned int, call )
376 __field(struct rxrpc_call *, rx_call )
378 __field(u32, abort_code )
382 __entry->call = call->debug_id;
383 __entry->rx_call = call->rxcall;
384 __entry->ret = call->error;
385 __entry->abort_code = call->abort_code;
388 TP_printk(" c=%08x ret=%d ab=%d [%p]",
395 TRACE_EVENT(afs_send_pages,
396 TP_PROTO(struct afs_call *call, struct msghdr *msg,
397 pgoff_t first, pgoff_t last, unsigned int offset),
399 TP_ARGS(call, msg, first, last, offset),
402 __field(unsigned int, call )
403 __field(pgoff_t, first )
404 __field(pgoff_t, last )
405 __field(unsigned int, nr )
406 __field(unsigned int, bytes )
407 __field(unsigned int, offset )
408 __field(unsigned int, flags )
412 __entry->call = call->debug_id;
413 __entry->first = first;
414 __entry->last = last;
415 __entry->nr = msg->msg_iter.nr_segs;
416 __entry->bytes = msg->msg_iter.count;
417 __entry->offset = offset;
418 __entry->flags = msg->msg_flags;
421 TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
423 __entry->first, __entry->first + __entry->nr - 1, __entry->last,
424 __entry->bytes, __entry->offset,
428 TRACE_EVENT(afs_sent_pages,
429 TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
430 pgoff_t cursor, int ret),
432 TP_ARGS(call, first, last, cursor, ret),
435 __field(unsigned int, call )
436 __field(pgoff_t, first )
437 __field(pgoff_t, last )
438 __field(pgoff_t, cursor )
443 __entry->call = call->debug_id;
444 __entry->first = first;
445 __entry->last = last;
446 __entry->cursor = cursor;
450 TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
452 __entry->first, __entry->last,
453 __entry->cursor, __entry->ret)
456 TRACE_EVENT(afs_dir_check_failed,
457 TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
459 TP_ARGS(vnode, off, i_size),
462 __field(struct afs_vnode *, vnode )
463 __field(loff_t, off )
464 __field(loff_t, i_size )
468 __entry->vnode = vnode;
470 __entry->i_size = i_size;
473 TP_printk("vn=%p %llx/%llx",
474 __entry->vnode, __entry->off, __entry->i_size)
478 * We use page->private to hold the amount of the page that we've written to,
479 * splitting the field into two parts. However, we need to represent a range
480 * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
482 #if PAGE_SIZE > 32768
483 #define AFS_PRIV_MAX 0xffffffff
484 #define AFS_PRIV_SHIFT 32
486 #define AFS_PRIV_MAX 0xffff
487 #define AFS_PRIV_SHIFT 16
490 TRACE_EVENT(afs_page_dirty,
491 TP_PROTO(struct afs_vnode *vnode, const char *where,
492 pgoff_t page, unsigned long priv),
494 TP_ARGS(vnode, where, page, priv),
497 __field(struct afs_vnode *, vnode )
498 __field(const char *, where )
499 __field(pgoff_t, page )
500 __field(unsigned long, priv )
504 __entry->vnode = vnode;
505 __entry->where = where;
506 __entry->page = page;
507 __entry->priv = priv;
510 TP_printk("vn=%p %lx %s %lu-%lu",
511 __entry->vnode, __entry->page, __entry->where,
512 __entry->priv & AFS_PRIV_MAX,
513 __entry->priv >> AFS_PRIV_SHIFT)
516 TRACE_EVENT(afs_call_state,
517 TP_PROTO(struct afs_call *call,
518 enum afs_call_state from,
519 enum afs_call_state to,
520 int ret, u32 remote_abort),
522 TP_ARGS(call, from, to, ret, remote_abort),
525 __field(unsigned int, call )
526 __field(enum afs_call_state, from )
527 __field(enum afs_call_state, to )
533 __entry->call = call->debug_id;
534 __entry->from = from;
537 __entry->abort = remote_abort;
540 TP_printk("c=%08x %u->%u r=%d ab=%d",
542 __entry->from, __entry->to,
543 __entry->ret, __entry->abort)
546 TRACE_EVENT(afs_edit_dir,
547 TP_PROTO(struct afs_vnode *dvnode,
548 enum afs_edit_dir_reason why,
549 enum afs_edit_dir_op op,
552 unsigned int f_vnode,
553 unsigned int f_unique,
556 TP_ARGS(dvnode, why, op, block, slot, f_vnode, f_unique, name),
559 __field(unsigned int, vnode )
560 __field(unsigned int, unique )
561 __field(enum afs_edit_dir_reason, why )
562 __field(enum afs_edit_dir_op, op )
563 __field(unsigned int, block )
564 __field(unsigned short, slot )
565 __field(unsigned int, f_vnode )
566 __field(unsigned int, f_unique )
567 __array(char, name, 18 )
571 int __len = strlen(name);
572 __len = min(__len, 17);
573 __entry->vnode = dvnode->fid.vnode;
574 __entry->unique = dvnode->fid.unique;
577 __entry->block = block;
578 __entry->slot = slot;
579 __entry->f_vnode = f_vnode;
580 __entry->f_unique = f_unique;
581 memcpy(__entry->name, name, __len);
582 __entry->name[__len] = 0;
585 TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x %s",
586 __entry->vnode, __entry->unique,
587 __print_symbolic(__entry->why, afs_edit_dir_reasons),
588 __print_symbolic(__entry->op, afs_edit_dir_ops),
589 __entry->block, __entry->slot,
590 __entry->f_vnode, __entry->f_unique,
594 TRACE_EVENT(afs_protocol_error,
595 TP_PROTO(struct afs_call *call, int error, enum afs_eproto_cause cause),
597 TP_ARGS(call, error, cause),
600 __field(unsigned int, call )
602 __field(enum afs_eproto_cause, cause )
606 __entry->call = call ? call->debug_id : 0;
607 __entry->error = error;
608 __entry->cause = cause;
611 TP_printk("c=%08x r=%d %s",
612 __entry->call, __entry->error,
613 __print_symbolic(__entry->cause, afs_eproto_causes))
616 TRACE_EVENT(afs_cm_no_server,
617 TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx),
622 __field(unsigned int, call )
623 __field(unsigned int, op_id )
624 __field_struct(struct sockaddr_rxrpc, srx )
628 __entry->call = call->debug_id;
629 __entry->op_id = call->operation_ID;
630 memcpy(&__entry->srx, srx, sizeof(__entry->srx));
633 TP_printk("c=%08x op=%u %pISpc",
634 __entry->call, __entry->op_id, &__entry->srx.transport)
637 TRACE_EVENT(afs_cm_no_server_u,
638 TP_PROTO(struct afs_call *call, const uuid_t *uuid),
643 __field(unsigned int, call )
644 __field(unsigned int, op_id )
645 __field_struct(uuid_t, uuid )
649 __entry->call = call->debug_id;
650 __entry->op_id = call->operation_ID;
651 memcpy(&__entry->uuid, uuid, sizeof(__entry->uuid));
654 TP_printk("c=%08x op=%u %pU",
655 __entry->call, __entry->op_id, &__entry->uuid)
658 #endif /* _TRACE_AFS_H */
660 /* This part must be outside protection */
661 #include <trace/define_trace.h>