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(struct rxrpc_call
*, rxcall
)
137 __field(struct afs_call
*, call
)
138 __field(enum afs_call_state
, state
)
139 __field(unsigned int, count
)
140 __field(unsigned int, offset
)
141 __field(unsigned short, unmarshall
)
142 __field(bool, want_more
)
147 __entry
->rxcall
= call
->rxcall
;
148 __entry
->call
= call
;
149 __entry
->state
= call
->state
;
150 __entry
->unmarshall
= call
->unmarshall
;
151 __entry
->count
= count
;
152 __entry
->offset
= offset
;
153 __entry
->want_more
= want_more
;
157 TP_printk("c=%p ac=%p s=%u u=%u %u/%u wm=%u ret=%d",
160 __entry
->state
, __entry
->unmarshall
,
161 __entry
->offset
, __entry
->count
,
162 __entry
->want_more
, __entry
->ret
)
165 TRACE_EVENT(afs_notify_call
,
166 TP_PROTO(struct rxrpc_call
*rxcall
, struct afs_call
*call
),
168 TP_ARGS(rxcall
, call
),
171 __field(struct rxrpc_call
*, rxcall
)
172 __field(struct afs_call
*, call
)
173 __field(enum afs_call_state
, state
)
174 __field(unsigned short, unmarshall
)
178 __entry
->rxcall
= rxcall
;
179 __entry
->call
= call
;
180 __entry
->state
= call
->state
;
181 __entry
->unmarshall
= call
->unmarshall
;
184 TP_printk("c=%p ac=%p s=%u u=%u",
187 __entry
->state
, __entry
->unmarshall
)
190 TRACE_EVENT(afs_cb_call
,
191 TP_PROTO(struct afs_call
*call
),
196 __field(struct rxrpc_call
*, rxcall
)
197 __field(struct afs_call
*, call
)
198 __field(const char *, name
)
203 __entry
->rxcall
= call
->rxcall
;
204 __entry
->call
= call
;
205 __entry
->name
= call
->type
->name
;
206 __entry
->op
= call
->operation_ID
;
209 TP_printk("c=%p ac=%p %s o=%u",
216 TRACE_EVENT(afs_call
,
217 TP_PROTO(struct afs_call
*call
, enum afs_call_trace op
,
218 int usage
, int outstanding
, const void *where
),
220 TP_ARGS(call
, op
, usage
, outstanding
, where
),
223 __field(struct afs_call
*, call
)
226 __field(int, outstanding
)
227 __field(const void *, where
)
231 __entry
->call
= call
;
233 __entry
->usage
= usage
;
234 __entry
->outstanding
= outstanding
;
235 __entry
->where
= where
;
238 TP_printk("c=%p %s u=%d o=%d sp=%pSR",
240 __print_symbolic(__entry
->op
, afs_call_traces
),
242 __entry
->outstanding
,
246 TRACE_EVENT(afs_make_fs_call
,
247 TP_PROTO(struct afs_call
*call
, const struct afs_fid
*fid
),
252 __field(struct afs_call
*, call
)
253 __field(enum afs_fs_operation
, op
)
254 __field_struct(struct afs_fid
, fid
)
258 __entry
->call
= call
;
259 __entry
->op
= call
->operation_ID
;
263 __entry
->fid
.vid
= 0;
264 __entry
->fid
.vnode
= 0;
265 __entry
->fid
.unique
= 0;
269 TP_printk("c=%p %06x:%06x:%06x %s",
274 __print_symbolic(__entry
->op
, afs_fs_operations
))
277 TRACE_EVENT(afs_make_vl_call
,
278 TP_PROTO(struct afs_call
*call
),
283 __field(struct afs_call
*, call
)
284 __field(enum afs_vl_operation
, op
)
288 __entry
->call
= call
;
289 __entry
->op
= call
->operation_ID
;
294 __print_symbolic(__entry
->op
, afs_vl_operations
))
297 TRACE_EVENT(afs_call_done
,
298 TP_PROTO(struct afs_call
*call
),
303 __field(struct afs_call
*, call
)
304 __field(struct rxrpc_call
*, rx_call
)
306 __field(u32
, abort_code
)
310 __entry
->call
= call
;
311 __entry
->rx_call
= call
->rxcall
;
312 __entry
->ret
= call
->error
;
313 __entry
->abort_code
= call
->abort_code
;
316 TP_printk(" c=%p ret=%d ab=%d [%p]",
323 TRACE_EVENT(afs_send_pages
,
324 TP_PROTO(struct afs_call
*call
, struct msghdr
*msg
,
325 pgoff_t first
, pgoff_t last
, unsigned int offset
),
327 TP_ARGS(call
, msg
, first
, last
, offset
),
330 __field(struct afs_call
*, call
)
331 __field(pgoff_t
, first
)
332 __field(pgoff_t
, last
)
333 __field(unsigned int, nr
)
334 __field(unsigned int, bytes
)
335 __field(unsigned int, offset
)
336 __field(unsigned int, flags
)
340 __entry
->call
= call
;
341 __entry
->first
= first
;
342 __entry
->last
= last
;
343 __entry
->nr
= msg
->msg_iter
.nr_segs
;
344 __entry
->bytes
= msg
->msg_iter
.count
;
345 __entry
->offset
= offset
;
346 __entry
->flags
= msg
->msg_flags
;
349 TP_printk(" c=%p %lx-%lx-%lx b=%x o=%x f=%x",
351 __entry
->first
, __entry
->first
+ __entry
->nr
- 1, __entry
->last
,
352 __entry
->bytes
, __entry
->offset
,
356 TRACE_EVENT(afs_sent_pages
,
357 TP_PROTO(struct afs_call
*call
, pgoff_t first
, pgoff_t last
,
358 pgoff_t cursor
, int ret
),
360 TP_ARGS(call
, first
, last
, cursor
, ret
),
363 __field(struct afs_call
*, call
)
364 __field(pgoff_t
, first
)
365 __field(pgoff_t
, last
)
366 __field(pgoff_t
, cursor
)
371 __entry
->call
= call
;
372 __entry
->first
= first
;
373 __entry
->last
= last
;
374 __entry
->cursor
= cursor
;
378 TP_printk(" c=%p %lx-%lx c=%lx r=%d",
380 __entry
->first
, __entry
->last
,
381 __entry
->cursor
, __entry
->ret
)
384 TRACE_EVENT(afs_dir_check_failed
,
385 TP_PROTO(struct afs_vnode
*vnode
, loff_t off
, loff_t i_size
),
387 TP_ARGS(vnode
, off
, i_size
),
390 __field(struct afs_vnode
*, vnode
)
391 __field(loff_t
, off
)
392 __field(loff_t
, i_size
)
396 __entry
->vnode
= vnode
;
398 __entry
->i_size
= i_size
;
401 TP_printk("vn=%p %llx/%llx",
402 __entry
->vnode
, __entry
->off
, __entry
->i_size
)
406 * We use page->private to hold the amount of the page that we've written to,
407 * splitting the field into two parts. However, we need to represent a range
408 * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
410 #if PAGE_SIZE > 32768
411 #define AFS_PRIV_MAX 0xffffffff
412 #define AFS_PRIV_SHIFT 32
414 #define AFS_PRIV_MAX 0xffff
415 #define AFS_PRIV_SHIFT 16
418 TRACE_EVENT(afs_page_dirty
,
419 TP_PROTO(struct afs_vnode
*vnode
, const char *where
,
420 pgoff_t page
, unsigned long priv
),
422 TP_ARGS(vnode
, where
, page
, priv
),
425 __field(struct afs_vnode
*, vnode
)
426 __field(const char *, where
)
427 __field(pgoff_t
, page
)
428 __field(unsigned long, priv
)
432 __entry
->vnode
= vnode
;
433 __entry
->where
= where
;
434 __entry
->page
= page
;
435 __entry
->priv
= priv
;
438 TP_printk("vn=%p %lx %s %lu-%lu",
439 __entry
->vnode
, __entry
->page
, __entry
->where
,
440 __entry
->priv
& AFS_PRIV_MAX
,
441 __entry
->priv
>> AFS_PRIV_SHIFT
)
444 TRACE_EVENT(afs_call_state
,
445 TP_PROTO(struct afs_call
*call
,
446 enum afs_call_state from
,
447 enum afs_call_state to
,
448 int ret
, u32 remote_abort
),
450 TP_ARGS(call
, from
, to
, ret
, remote_abort
),
453 __field(struct afs_call
*, call
)
454 __field(enum afs_call_state
, from
)
455 __field(enum afs_call_state
, to
)
461 __entry
->call
= call
;
462 __entry
->from
= from
;
465 __entry
->abort
= remote_abort
;
468 TP_printk("c=%p %u->%u r=%d ab=%d",
470 __entry
->from
, __entry
->to
,
471 __entry
->ret
, __entry
->abort
)
474 #endif /* _TRACE_AFS_H */
476 /* This part must be outside protection */
477 #include <trace/define_trace.h>