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,
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,
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,
124 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
127 * Declare tracing information enums and their string mappings for display.
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 ")
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")
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")
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")
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")
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")
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")
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")
221 * Export enum symbols via userspace.
225 #define EM(a, b) TRACE_DEFINE_ENUM(a);
226 #define E_(a, b) TRACE_DEFINE_ENUM(a);
232 afs_edit_dir_reasons;
238 * Now redefine the EM() and E_() macros to map the enums to the strings that
239 * will be printed in the output.
243 #define EM(a, b) { a, b },
244 #define E_(a, b) { a, b }
246 TRACE_EVENT(afs_receive_data,
247 TP_PROTO(struct afs_call *call, struct iov_iter *iter,
248 bool want_more, int ret),
250 TP_ARGS(call, iter, want_more, ret),
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 )
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;
270 TP_printk("c=%08x r=%llu u=%u w=%u s=%u ret=%d",
279 TRACE_EVENT(afs_notify_call,
280 TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
282 TP_ARGS(rxcall, call),
285 __field(unsigned int, call )
286 __field(enum afs_call_state, state )
287 __field(unsigned short, unmarshall )
291 __entry->call = call->debug_id;
292 __entry->state = call->state;
293 __entry->unmarshall = call->unmarshall;
296 TP_printk("c=%08x s=%u u=%u",
298 __entry->state, __entry->unmarshall)
301 TRACE_EVENT(afs_cb_call,
302 TP_PROTO(struct afs_call *call),
307 __field(unsigned int, call )
308 __field(const char *, name )
313 __entry->call = call->debug_id;
314 __entry->name = call->type->name;
315 __entry->op = call->operation_ID;
318 TP_printk("c=%08x %s o=%u",
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),
328 TP_ARGS(call, op, usage, outstanding, where),
331 __field(unsigned int, call )
334 __field(int, outstanding )
335 __field(const void *, where )
339 __entry->call = call->debug_id;
341 __entry->usage = usage;
342 __entry->outstanding = outstanding;
343 __entry->where = where;
346 TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
348 __print_symbolic(__entry->op, afs_call_traces),
350 __entry->outstanding,
354 TRACE_EVENT(afs_make_fs_call,
355 TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
360 __field(unsigned int, call )
361 __field(enum afs_fs_operation, op )
362 __field_struct(struct afs_fid, fid )
366 __entry->call = call->debug_id;
367 __entry->op = call->operation_ID;
371 __entry->fid.vid = 0;
372 __entry->fid.vnode = 0;
373 __entry->fid.unique = 0;
377 TP_printk("c=%08x %06llx:%06llx:%06x %s",
382 __print_symbolic(__entry->op, afs_fs_operations))
385 TRACE_EVENT(afs_make_vl_call,
386 TP_PROTO(struct afs_call *call),
391 __field(unsigned int, call )
392 __field(enum afs_vl_operation, op )
396 __entry->call = call->debug_id;
397 __entry->op = call->operation_ID;
400 TP_printk("c=%08x %s",
402 __print_symbolic(__entry->op, afs_vl_operations))
405 TRACE_EVENT(afs_call_done,
406 TP_PROTO(struct afs_call *call),
411 __field(unsigned int, call )
412 __field(struct rxrpc_call *, rx_call )
414 __field(u32, abort_code )
418 __entry->call = call->debug_id;
419 __entry->rx_call = call->rxcall;
420 __entry->ret = call->error;
421 __entry->abort_code = call->abort_code;
424 TP_printk(" c=%08x ret=%d ab=%d [%p]",
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),
435 TP_ARGS(call, msg, first, last, offset),
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 )
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;
457 TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
459 __entry->first, __entry->first + __entry->nr - 1, __entry->last,
460 __entry->bytes, __entry->offset,
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),
468 TP_ARGS(call, first, last, cursor, ret),
471 __field(unsigned int, call )
472 __field(pgoff_t, first )
473 __field(pgoff_t, last )
474 __field(pgoff_t, cursor )
479 __entry->call = call->debug_id;
480 __entry->first = first;
481 __entry->last = last;
482 __entry->cursor = cursor;
486 TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
488 __entry->first, __entry->last,
489 __entry->cursor, __entry->ret)
492 TRACE_EVENT(afs_dir_check_failed,
493 TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
495 TP_ARGS(vnode, off, i_size),
498 __field(struct afs_vnode *, vnode )
499 __field(loff_t, off )
500 __field(loff_t, i_size )
504 __entry->vnode = vnode;
506 __entry->i_size = i_size;
509 TP_printk("vn=%p %llx/%llx",
510 __entry->vnode, __entry->off, __entry->i_size)
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.
518 #if PAGE_SIZE > 32768
519 #define AFS_PRIV_MAX 0xffffffff
520 #define AFS_PRIV_SHIFT 32
522 #define AFS_PRIV_MAX 0xffff
523 #define AFS_PRIV_SHIFT 16
526 TRACE_EVENT(afs_page_dirty,
527 TP_PROTO(struct afs_vnode *vnode, const char *where,
528 pgoff_t page, unsigned long priv),
530 TP_ARGS(vnode, where, page, priv),
533 __field(struct afs_vnode *, vnode )
534 __field(const char *, where )
535 __field(pgoff_t, page )
536 __field(unsigned long, priv )
540 __entry->vnode = vnode;
541 __entry->where = where;
542 __entry->page = page;
543 __entry->priv = priv;
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)
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),
558 TP_ARGS(call, from, to, ret, remote_abort),
561 __field(unsigned int, call )
562 __field(enum afs_call_state, from )
563 __field(enum afs_call_state, to )
569 __entry->call = call->debug_id;
570 __entry->from = from;
573 __entry->abort = remote_abort;
576 TP_printk("c=%08x %u->%u r=%d ab=%d",
578 __entry->from, __entry->to,
579 __entry->ret, __entry->abort)
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,
588 unsigned int f_vnode,
589 unsigned int f_unique,
592 TP_ARGS(dvnode, why, op, block, slot, f_vnode, f_unique, name),
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 )
607 int __len = strlen(name);
608 __len = min(__len, 17);
609 __entry->vnode = dvnode->fid.vnode;
610 __entry->unique = dvnode->fid.unique;
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;
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,
630 TRACE_EVENT(afs_protocol_error,
631 TP_PROTO(struct afs_call *call, int error, enum afs_eproto_cause cause),
633 TP_ARGS(call, error, cause),
636 __field(unsigned int, call )
638 __field(enum afs_eproto_cause, cause )
642 __entry->call = call ? call->debug_id : 0;
643 __entry->error = error;
644 __entry->cause = cause;
647 TP_printk("c=%08x r=%d %s",
648 __entry->call, __entry->error,
649 __print_symbolic(__entry->cause, afs_eproto_causes))
652 TRACE_EVENT(afs_io_error,
653 TP_PROTO(unsigned int call, int error, enum afs_io_error where),
655 TP_ARGS(call, error, where),
658 __field(unsigned int, call )
660 __field(enum afs_io_error, where )
664 __entry->call = call;
665 __entry->error = error;
666 __entry->where = where;
669 TP_printk("c=%08x r=%d %s",
670 __entry->call, __entry->error,
671 __print_symbolic(__entry->where, afs_io_errors))
674 TRACE_EVENT(afs_file_error,
675 TP_PROTO(struct afs_vnode *vnode, int error, enum afs_file_error where),
677 TP_ARGS(vnode, error, where),
680 __field_struct(struct afs_fid, fid )
682 __field(enum afs_file_error, where )
686 __entry->fid = vnode->fid;
687 __entry->error = error;
688 __entry->where = where;
691 TP_printk("%llx:%llx:%x r=%d %s",
692 __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
694 __print_symbolic(__entry->where, afs_file_errors))
697 TRACE_EVENT(afs_cm_no_server,
698 TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx),
703 __field(unsigned int, call )
704 __field(unsigned int, op_id )
705 __field_struct(struct sockaddr_rxrpc, srx )
709 __entry->call = call->debug_id;
710 __entry->op_id = call->operation_ID;
711 memcpy(&__entry->srx, srx, sizeof(__entry->srx));
714 TP_printk("c=%08x op=%u %pISpc",
715 __entry->call, __entry->op_id, &__entry->srx.transport)
718 TRACE_EVENT(afs_cm_no_server_u,
719 TP_PROTO(struct afs_call *call, const uuid_t *uuid),
724 __field(unsigned int, call )
725 __field(unsigned int, op_id )
726 __field_struct(uuid_t, uuid )
730 __entry->call = call->debug_id;
731 __entry->op_id = call->operation_ID;
732 memcpy(&__entry->uuid, uuid, sizeof(__entry->uuid));
735 TP_printk("c=%08x op=%u %pU",
736 __entry->call, __entry->op_id, &__entry->uuid)
739 #endif /* _TRACE_AFS_H */
741 /* This part must be outside protection */
742 #include <trace/define_trace.h>