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_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 */
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 */
65 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
68 * Declare tracing information enums and their string mappings for display.
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 ")
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")
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")
109 * Export enum symbols via userspace.
113 #define EM(a, b) TRACE_DEFINE_ENUM(a);
114 #define E_(a, b) TRACE_DEFINE_ENUM(a);
121 * Now redefine the EM() and E_() macros to map the enums to the strings that
122 * will be printed in the output.
126 #define EM(a, b) { a, b },
127 #define E_(a, b) { a, b }
129 TRACE_EVENT(afs_recv_data
,
130 TP_PROTO(struct afs_call
*call
, unsigned count
, unsigned offset
,
131 bool want_more
, int ret
),
133 TP_ARGS(call
, count
, offset
, want_more
, ret
),
136 __field(unsigned int, call
)
137 __field(enum afs_call_state
, state
)
138 __field(unsigned int, count
)
139 __field(unsigned int, offset
)
140 __field(unsigned short, unmarshall
)
141 __field(bool, want_more
)
146 __entry
->call
= call
->debug_id
;
147 __entry
->state
= call
->state
;
148 __entry
->unmarshall
= call
->unmarshall
;
149 __entry
->count
= count
;
150 __entry
->offset
= offset
;
151 __entry
->want_more
= want_more
;
155 TP_printk("c=%08x s=%u u=%u %u/%u wm=%u ret=%d",
157 __entry
->state
, __entry
->unmarshall
,
158 __entry
->offset
, __entry
->count
,
159 __entry
->want_more
, __entry
->ret
)
162 TRACE_EVENT(afs_notify_call
,
163 TP_PROTO(struct rxrpc_call
*rxcall
, struct afs_call
*call
),
165 TP_ARGS(rxcall
, call
),
168 __field(unsigned int, call
)
169 __field(enum afs_call_state
, state
)
170 __field(unsigned short, unmarshall
)
174 __entry
->call
= call
->debug_id
;
175 __entry
->state
= call
->state
;
176 __entry
->unmarshall
= call
->unmarshall
;
179 TP_printk("c=%08x s=%u u=%u",
181 __entry
->state
, __entry
->unmarshall
)
184 TRACE_EVENT(afs_cb_call
,
185 TP_PROTO(struct afs_call
*call
),
190 __field(unsigned int, call
)
191 __field(const char *, name
)
196 __entry
->call
= call
->debug_id
;
197 __entry
->name
= call
->type
->name
;
198 __entry
->op
= call
->operation_ID
;
201 TP_printk("c=%08x %s o=%u",
207 TRACE_EVENT(afs_call
,
208 TP_PROTO(struct afs_call
*call
, enum afs_call_trace op
,
209 int usage
, int outstanding
, const void *where
),
211 TP_ARGS(call
, op
, usage
, outstanding
, where
),
214 __field(unsigned int, call
)
217 __field(int, outstanding
)
218 __field(const void *, where
)
222 __entry
->call
= call
->debug_id
;
224 __entry
->usage
= usage
;
225 __entry
->outstanding
= outstanding
;
226 __entry
->where
= where
;
229 TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
231 __print_symbolic(__entry
->op
, afs_call_traces
),
233 __entry
->outstanding
,
237 TRACE_EVENT(afs_make_fs_call
,
238 TP_PROTO(struct afs_call
*call
, const struct afs_fid
*fid
),
243 __field(unsigned int, call
)
244 __field(enum afs_fs_operation
, op
)
245 __field_struct(struct afs_fid
, fid
)
249 __entry
->call
= call
->debug_id
;
250 __entry
->op
= call
->operation_ID
;
254 __entry
->fid
.vid
= 0;
255 __entry
->fid
.vnode
= 0;
256 __entry
->fid
.unique
= 0;
260 TP_printk("c=%08x %06x:%06x:%06x %s",
265 __print_symbolic(__entry
->op
, afs_fs_operations
))
268 TRACE_EVENT(afs_make_vl_call
,
269 TP_PROTO(struct afs_call
*call
),
274 __field(unsigned int, call
)
275 __field(enum afs_vl_operation
, op
)
279 __entry
->call
= call
->debug_id
;
280 __entry
->op
= call
->operation_ID
;
283 TP_printk("c=%08x %s",
285 __print_symbolic(__entry
->op
, afs_vl_operations
))
288 TRACE_EVENT(afs_call_done
,
289 TP_PROTO(struct afs_call
*call
),
294 __field(unsigned int, call
)
295 __field(struct rxrpc_call
*, rx_call
)
297 __field(u32
, abort_code
)
301 __entry
->call
= call
->debug_id
;
302 __entry
->rx_call
= call
->rxcall
;
303 __entry
->ret
= call
->error
;
304 __entry
->abort_code
= call
->abort_code
;
307 TP_printk(" c=%08x ret=%d ab=%d [%p]",
314 TRACE_EVENT(afs_send_pages
,
315 TP_PROTO(struct afs_call
*call
, struct msghdr
*msg
,
316 pgoff_t first
, pgoff_t last
, unsigned int offset
),
318 TP_ARGS(call
, msg
, first
, last
, offset
),
321 __field(unsigned int, call
)
322 __field(pgoff_t
, first
)
323 __field(pgoff_t
, last
)
324 __field(unsigned int, nr
)
325 __field(unsigned int, bytes
)
326 __field(unsigned int, offset
)
327 __field(unsigned int, flags
)
331 __entry
->call
= call
->debug_id
;
332 __entry
->first
= first
;
333 __entry
->last
= last
;
334 __entry
->nr
= msg
->msg_iter
.nr_segs
;
335 __entry
->bytes
= msg
->msg_iter
.count
;
336 __entry
->offset
= offset
;
337 __entry
->flags
= msg
->msg_flags
;
340 TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
342 __entry
->first
, __entry
->first
+ __entry
->nr
- 1, __entry
->last
,
343 __entry
->bytes
, __entry
->offset
,
347 TRACE_EVENT(afs_sent_pages
,
348 TP_PROTO(struct afs_call
*call
, pgoff_t first
, pgoff_t last
,
349 pgoff_t cursor
, int ret
),
351 TP_ARGS(call
, first
, last
, cursor
, ret
),
354 __field(unsigned int, call
)
355 __field(pgoff_t
, first
)
356 __field(pgoff_t
, last
)
357 __field(pgoff_t
, cursor
)
362 __entry
->call
= call
->debug_id
;
363 __entry
->first
= first
;
364 __entry
->last
= last
;
365 __entry
->cursor
= cursor
;
369 TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
371 __entry
->first
, __entry
->last
,
372 __entry
->cursor
, __entry
->ret
)
375 TRACE_EVENT(afs_dir_check_failed
,
376 TP_PROTO(struct afs_vnode
*vnode
, loff_t off
, loff_t i_size
),
378 TP_ARGS(vnode
, off
, i_size
),
381 __field(struct afs_vnode
*, vnode
)
382 __field(loff_t
, off
)
383 __field(loff_t
, i_size
)
387 __entry
->vnode
= vnode
;
389 __entry
->i_size
= i_size
;
392 TP_printk("vn=%p %llx/%llx",
393 __entry
->vnode
, __entry
->off
, __entry
->i_size
)
397 * We use page->private to hold the amount of the page that we've written to,
398 * splitting the field into two parts. However, we need to represent a range
399 * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
401 #if PAGE_SIZE > 32768
402 #define AFS_PRIV_MAX 0xffffffff
403 #define AFS_PRIV_SHIFT 32
405 #define AFS_PRIV_MAX 0xffff
406 #define AFS_PRIV_SHIFT 16
409 TRACE_EVENT(afs_page_dirty
,
410 TP_PROTO(struct afs_vnode
*vnode
, const char *where
,
411 pgoff_t page
, unsigned long priv
),
413 TP_ARGS(vnode
, where
, page
, priv
),
416 __field(struct afs_vnode
*, vnode
)
417 __field(const char *, where
)
418 __field(pgoff_t
, page
)
419 __field(unsigned long, priv
)
423 __entry
->vnode
= vnode
;
424 __entry
->where
= where
;
425 __entry
->page
= page
;
426 __entry
->priv
= priv
;
429 TP_printk("vn=%p %lx %s %lu-%lu",
430 __entry
->vnode
, __entry
->page
, __entry
->where
,
431 __entry
->priv
& AFS_PRIV_MAX
,
432 __entry
->priv
>> AFS_PRIV_SHIFT
)
435 TRACE_EVENT(afs_call_state
,
436 TP_PROTO(struct afs_call
*call
,
437 enum afs_call_state from
,
438 enum afs_call_state to
,
439 int ret
, u32 remote_abort
),
441 TP_ARGS(call
, from
, to
, ret
, remote_abort
),
444 __field(unsigned int, call
)
445 __field(enum afs_call_state
, from
)
446 __field(enum afs_call_state
, to
)
452 __entry
->call
= call
->debug_id
;
453 __entry
->from
= from
;
456 __entry
->abort
= remote_abort
;
459 TP_printk("c=%08x %u->%u r=%d ab=%d",
461 __entry
->from
, __entry
->to
,
462 __entry
->ret
, __entry
->abort
)
465 #endif /* _TRACE_AFS_H */
467 /* This part must be outside protection */
468 #include <trace/define_trace.h>