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 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
90 * Declare tracing information enums and their string mappings for display.
92 #define afs_call_traces \
93 EM(afs_call_trace_alloc, "ALLOC") \
94 EM(afs_call_trace_free, "FREE ") \
95 EM(afs_call_trace_put, "PUT ") \
96 EM(afs_call_trace_wake, "WAKE ") \
97 E_(afs_call_trace_work, "QUEUE")
99 #define afs_fs_operations \
100 EM(afs_FS_FetchData, "FS.FetchData") \
101 EM(afs_FS_FetchStatus, "FS.FetchStatus") \
102 EM(afs_FS_StoreData, "FS.StoreData") \
103 EM(afs_FS_StoreStatus, "FS.StoreStatus") \
104 EM(afs_FS_RemoveFile, "FS.RemoveFile") \
105 EM(afs_FS_CreateFile, "FS.CreateFile") \
106 EM(afs_FS_Rename, "FS.Rename") \
107 EM(afs_FS_Symlink, "FS.Symlink") \
108 EM(afs_FS_Link, "FS.Link") \
109 EM(afs_FS_MakeDir, "FS.MakeDir") \
110 EM(afs_FS_RemoveDir, "FS.RemoveDir") \
111 EM(afs_FS_GetVolumeInfo, "FS.GetVolumeInfo") \
112 EM(afs_FS_GetVolumeStatus, "FS.GetVolumeStatus") \
113 EM(afs_FS_GetRootVolume, "FS.GetRootVolume") \
114 EM(afs_FS_SetLock, "FS.SetLock") \
115 EM(afs_FS_ExtendLock, "FS.ExtendLock") \
116 EM(afs_FS_ReleaseLock, "FS.ReleaseLock") \
117 EM(afs_FS_Lookup, "FS.Lookup") \
118 EM(afs_FS_InlineBulkStatus, "FS.InlineBulkStatus") \
119 EM(afs_FS_FetchData64, "FS.FetchData64") \
120 EM(afs_FS_StoreData64, "FS.StoreData64") \
121 EM(afs_FS_GiveUpAllCallBacks, "FS.GiveUpAllCallBacks") \
122 E_(afs_FS_GetCapabilities, "FS.GetCapabilities")
124 #define afs_vl_operations \
125 EM(afs_VL_GetEntryByNameU, "VL.GetEntryByNameU") \
126 EM(afs_VL_GetAddrsU, "VL.GetAddrsU") \
127 EM(afs_YFSVL_GetEndpoints, "YFSVL.GetEndpoints") \
128 E_(afs_VL_GetCapabilities, "VL.GetCapabilities")
130 #define afs_edit_dir_ops \
131 EM(afs_edit_dir_create, "create") \
132 EM(afs_edit_dir_create_error, "c_fail") \
133 EM(afs_edit_dir_create_inval, "c_invl") \
134 EM(afs_edit_dir_create_nospc, "c_nspc") \
135 EM(afs_edit_dir_delete, "delete") \
136 EM(afs_edit_dir_delete_error, "d_err ") \
137 EM(afs_edit_dir_delete_inval, "d_invl") \
138 E_(afs_edit_dir_delete_noent, "d_nent")
140 #define afs_edit_dir_reasons \
141 EM(afs_edit_dir_for_create, "Create") \
142 EM(afs_edit_dir_for_link, "Link ") \
143 EM(afs_edit_dir_for_mkdir, "MkDir ") \
144 EM(afs_edit_dir_for_rename, "Rename") \
145 EM(afs_edit_dir_for_rmdir, "RmDir ") \
146 EM(afs_edit_dir_for_symlink, "Symlnk") \
147 E_(afs_edit_dir_for_unlink, "Unlink")
151 * Export enum symbols via userspace.
155 #define EM(a, b) TRACE_DEFINE_ENUM(a);
156 #define E_(a, b) TRACE_DEFINE_ENUM(a);
162 afs_edit_dir_reasons
;
165 * Now redefine the EM() and E_() macros to map the enums to the strings that
166 * will be printed in the output.
170 #define EM(a, b) { a, b },
171 #define E_(a, b) { a, b }
173 TRACE_EVENT(afs_recv_data
,
174 TP_PROTO(struct afs_call
*call
, unsigned count
, unsigned offset
,
175 bool want_more
, int ret
),
177 TP_ARGS(call
, count
, offset
, want_more
, ret
),
180 __field(unsigned int, call
)
181 __field(enum afs_call_state
, state
)
182 __field(unsigned int, count
)
183 __field(unsigned int, offset
)
184 __field(unsigned short, unmarshall
)
185 __field(bool, want_more
)
190 __entry
->call
= call
->debug_id
;
191 __entry
->state
= call
->state
;
192 __entry
->unmarshall
= call
->unmarshall
;
193 __entry
->count
= count
;
194 __entry
->offset
= offset
;
195 __entry
->want_more
= want_more
;
199 TP_printk("c=%08x s=%u u=%u %u/%u wm=%u ret=%d",
201 __entry
->state
, __entry
->unmarshall
,
202 __entry
->offset
, __entry
->count
,
203 __entry
->want_more
, __entry
->ret
)
206 TRACE_EVENT(afs_notify_call
,
207 TP_PROTO(struct rxrpc_call
*rxcall
, struct afs_call
*call
),
209 TP_ARGS(rxcall
, call
),
212 __field(unsigned int, call
)
213 __field(enum afs_call_state
, state
)
214 __field(unsigned short, unmarshall
)
218 __entry
->call
= call
->debug_id
;
219 __entry
->state
= call
->state
;
220 __entry
->unmarshall
= call
->unmarshall
;
223 TP_printk("c=%08x s=%u u=%u",
225 __entry
->state
, __entry
->unmarshall
)
228 TRACE_EVENT(afs_cb_call
,
229 TP_PROTO(struct afs_call
*call
),
234 __field(unsigned int, call
)
235 __field(const char *, name
)
240 __entry
->call
= call
->debug_id
;
241 __entry
->name
= call
->type
->name
;
242 __entry
->op
= call
->operation_ID
;
245 TP_printk("c=%08x %s o=%u",
251 TRACE_EVENT(afs_call
,
252 TP_PROTO(struct afs_call
*call
, enum afs_call_trace op
,
253 int usage
, int outstanding
, const void *where
),
255 TP_ARGS(call
, op
, usage
, outstanding
, where
),
258 __field(unsigned int, call
)
261 __field(int, outstanding
)
262 __field(const void *, where
)
266 __entry
->call
= call
->debug_id
;
268 __entry
->usage
= usage
;
269 __entry
->outstanding
= outstanding
;
270 __entry
->where
= where
;
273 TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
275 __print_symbolic(__entry
->op
, afs_call_traces
),
277 __entry
->outstanding
,
281 TRACE_EVENT(afs_make_fs_call
,
282 TP_PROTO(struct afs_call
*call
, const struct afs_fid
*fid
),
287 __field(unsigned int, call
)
288 __field(enum afs_fs_operation
, op
)
289 __field_struct(struct afs_fid
, fid
)
293 __entry
->call
= call
->debug_id
;
294 __entry
->op
= call
->operation_ID
;
298 __entry
->fid
.vid
= 0;
299 __entry
->fid
.vnode
= 0;
300 __entry
->fid
.unique
= 0;
304 TP_printk("c=%08x %06x:%06x:%06x %s",
309 __print_symbolic(__entry
->op
, afs_fs_operations
))
312 TRACE_EVENT(afs_make_vl_call
,
313 TP_PROTO(struct afs_call
*call
),
318 __field(unsigned int, call
)
319 __field(enum afs_vl_operation
, op
)
323 __entry
->call
= call
->debug_id
;
324 __entry
->op
= call
->operation_ID
;
327 TP_printk("c=%08x %s",
329 __print_symbolic(__entry
->op
, afs_vl_operations
))
332 TRACE_EVENT(afs_call_done
,
333 TP_PROTO(struct afs_call
*call
),
338 __field(unsigned int, call
)
339 __field(struct rxrpc_call
*, rx_call
)
341 __field(u32
, abort_code
)
345 __entry
->call
= call
->debug_id
;
346 __entry
->rx_call
= call
->rxcall
;
347 __entry
->ret
= call
->error
;
348 __entry
->abort_code
= call
->abort_code
;
351 TP_printk(" c=%08x ret=%d ab=%d [%p]",
358 TRACE_EVENT(afs_send_pages
,
359 TP_PROTO(struct afs_call
*call
, struct msghdr
*msg
,
360 pgoff_t first
, pgoff_t last
, unsigned int offset
),
362 TP_ARGS(call
, msg
, first
, last
, offset
),
365 __field(unsigned int, call
)
366 __field(pgoff_t
, first
)
367 __field(pgoff_t
, last
)
368 __field(unsigned int, nr
)
369 __field(unsigned int, bytes
)
370 __field(unsigned int, offset
)
371 __field(unsigned int, flags
)
375 __entry
->call
= call
->debug_id
;
376 __entry
->first
= first
;
377 __entry
->last
= last
;
378 __entry
->nr
= msg
->msg_iter
.nr_segs
;
379 __entry
->bytes
= msg
->msg_iter
.count
;
380 __entry
->offset
= offset
;
381 __entry
->flags
= msg
->msg_flags
;
384 TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
386 __entry
->first
, __entry
->first
+ __entry
->nr
- 1, __entry
->last
,
387 __entry
->bytes
, __entry
->offset
,
391 TRACE_EVENT(afs_sent_pages
,
392 TP_PROTO(struct afs_call
*call
, pgoff_t first
, pgoff_t last
,
393 pgoff_t cursor
, int ret
),
395 TP_ARGS(call
, first
, last
, cursor
, ret
),
398 __field(unsigned int, call
)
399 __field(pgoff_t
, first
)
400 __field(pgoff_t
, last
)
401 __field(pgoff_t
, cursor
)
406 __entry
->call
= call
->debug_id
;
407 __entry
->first
= first
;
408 __entry
->last
= last
;
409 __entry
->cursor
= cursor
;
413 TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
415 __entry
->first
, __entry
->last
,
416 __entry
->cursor
, __entry
->ret
)
419 TRACE_EVENT(afs_dir_check_failed
,
420 TP_PROTO(struct afs_vnode
*vnode
, loff_t off
, loff_t i_size
),
422 TP_ARGS(vnode
, off
, i_size
),
425 __field(struct afs_vnode
*, vnode
)
426 __field(loff_t
, off
)
427 __field(loff_t
, i_size
)
431 __entry
->vnode
= vnode
;
433 __entry
->i_size
= i_size
;
436 TP_printk("vn=%p %llx/%llx",
437 __entry
->vnode
, __entry
->off
, __entry
->i_size
)
441 * We use page->private to hold the amount of the page that we've written to,
442 * splitting the field into two parts. However, we need to represent a range
443 * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
445 #if PAGE_SIZE > 32768
446 #define AFS_PRIV_MAX 0xffffffff
447 #define AFS_PRIV_SHIFT 32
449 #define AFS_PRIV_MAX 0xffff
450 #define AFS_PRIV_SHIFT 16
453 TRACE_EVENT(afs_page_dirty
,
454 TP_PROTO(struct afs_vnode
*vnode
, const char *where
,
455 pgoff_t page
, unsigned long priv
),
457 TP_ARGS(vnode
, where
, page
, priv
),
460 __field(struct afs_vnode
*, vnode
)
461 __field(const char *, where
)
462 __field(pgoff_t
, page
)
463 __field(unsigned long, priv
)
467 __entry
->vnode
= vnode
;
468 __entry
->where
= where
;
469 __entry
->page
= page
;
470 __entry
->priv
= priv
;
473 TP_printk("vn=%p %lx %s %lu-%lu",
474 __entry
->vnode
, __entry
->page
, __entry
->where
,
475 __entry
->priv
& AFS_PRIV_MAX
,
476 __entry
->priv
>> AFS_PRIV_SHIFT
)
479 TRACE_EVENT(afs_call_state
,
480 TP_PROTO(struct afs_call
*call
,
481 enum afs_call_state from
,
482 enum afs_call_state to
,
483 int ret
, u32 remote_abort
),
485 TP_ARGS(call
, from
, to
, ret
, remote_abort
),
488 __field(unsigned int, call
)
489 __field(enum afs_call_state
, from
)
490 __field(enum afs_call_state
, to
)
496 __entry
->call
= call
->debug_id
;
497 __entry
->from
= from
;
500 __entry
->abort
= remote_abort
;
503 TP_printk("c=%08x %u->%u r=%d ab=%d",
505 __entry
->from
, __entry
->to
,
506 __entry
->ret
, __entry
->abort
)
509 TRACE_EVENT(afs_edit_dir
,
510 TP_PROTO(struct afs_vnode
*dvnode
,
511 enum afs_edit_dir_reason why
,
512 enum afs_edit_dir_op op
,
515 unsigned int f_vnode
,
516 unsigned int f_unique
,
519 TP_ARGS(dvnode
, why
, op
, block
, slot
, f_vnode
, f_unique
, name
),
522 __field(unsigned int, vnode
)
523 __field(unsigned int, unique
)
524 __field(enum afs_edit_dir_reason
, why
)
525 __field(enum afs_edit_dir_op
, op
)
526 __field(unsigned int, block
)
527 __field(unsigned short, slot
)
528 __field(unsigned int, f_vnode
)
529 __field(unsigned int, f_unique
)
530 __array(char, name
, 18 )
534 int __len
= strlen(name
);
535 __len
= min(__len
, 17);
536 __entry
->vnode
= dvnode
->fid
.vnode
;
537 __entry
->unique
= dvnode
->fid
.unique
;
540 __entry
->block
= block
;
541 __entry
->slot
= slot
;
542 __entry
->f_vnode
= f_vnode
;
543 __entry
->f_unique
= f_unique
;
544 memcpy(__entry
->name
, name
, __len
);
545 __entry
->name
[__len
] = 0;
548 TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x %s",
549 __entry
->vnode
, __entry
->unique
,
550 __print_symbolic(__entry
->why
, afs_edit_dir_reasons
),
551 __print_symbolic(__entry
->op
, afs_edit_dir_ops
),
552 __entry
->block
, __entry
->slot
,
553 __entry
->f_vnode
, __entry
->f_unique
,
557 TRACE_EVENT(afs_protocol_error
,
558 TP_PROTO(struct afs_call
*call
, int error
, const void *where
),
560 TP_ARGS(call
, error
, where
),
563 __field(unsigned int, call
)
565 __field(const void *, where
)
569 __entry
->call
= call
? call
->debug_id
: 0;
570 __entry
->error
= error
;
571 __entry
->where
= where
;
574 TP_printk("c=%08x r=%d sp=%pSR",
575 __entry
->call
, __entry
->error
, __entry
->where
)
578 TRACE_EVENT(afs_cm_no_server
,
579 TP_PROTO(struct afs_call
*call
, struct sockaddr_rxrpc
*srx
),
584 __field(unsigned int, call
)
585 __field(unsigned int, op_id
)
586 __field_struct(struct sockaddr_rxrpc
, srx
)
590 __entry
->call
= call
->debug_id
;
591 __entry
->op_id
= call
->operation_ID
;
592 memcpy(&__entry
->srx
, srx
, sizeof(__entry
->srx
));
595 TP_printk("c=%08x op=%u %pISpc",
596 __entry
->call
, __entry
->op_id
, &__entry
->srx
.transport
)
599 TRACE_EVENT(afs_cm_no_server_u
,
600 TP_PROTO(struct afs_call
*call
, const uuid_t
*uuid
),
605 __field(unsigned int, call
)
606 __field(unsigned int, op_id
)
607 __field_struct(uuid_t
, uuid
)
611 __entry
->call
= call
->debug_id
;
612 __entry
->op_id
= call
->operation_ID
;
613 memcpy(&__entry
->uuid
, uuid
, sizeof(__entry
->uuid
));
616 TP_printk("c=%08x op=%u %pU",
617 __entry
->call
, __entry
->op_id
, &__entry
->uuid
)
620 #endif /* _TRACE_AFS_H */
622 /* This part must be outside protection */
623 #include <trace/define_trace.h>