xref: /openbmc/linux/include/trace/events/afs.h (revision add48ba4)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* AFS tracepoints
3  *
4  * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
5  * Written by David Howells (dhowells@redhat.com)
6  */
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM afs
9 
10 #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_AFS_H
12 
13 #include <linux/tracepoint.h>
14 
15 /*
16  * Define enums for tracing information.
17  */
18 #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
19 #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
20 
21 enum afs_call_trace {
22 	afs_call_trace_alloc,
23 	afs_call_trace_free,
24 	afs_call_trace_get,
25 	afs_call_trace_put,
26 	afs_call_trace_wake,
27 	afs_call_trace_work,
28 };
29 
30 enum afs_server_trace {
31 	afs_server_trace_alloc,
32 	afs_server_trace_callback,
33 	afs_server_trace_destroy,
34 	afs_server_trace_free,
35 	afs_server_trace_gc,
36 	afs_server_trace_get_by_addr,
37 	afs_server_trace_get_by_uuid,
38 	afs_server_trace_get_caps,
39 	afs_server_trace_get_install,
40 	afs_server_trace_get_new_cbi,
41 	afs_server_trace_get_probe,
42 	afs_server_trace_give_up_cb,
43 	afs_server_trace_put_call,
44 	afs_server_trace_put_cbi,
45 	afs_server_trace_put_find_rsq,
46 	afs_server_trace_put_probe,
47 	afs_server_trace_put_slist,
48 	afs_server_trace_put_slist_isort,
49 	afs_server_trace_put_uuid_rsq,
50 	afs_server_trace_update,
51 };
52 
53 enum afs_volume_trace {
54 	afs_volume_trace_alloc,
55 	afs_volume_trace_free,
56 	afs_volume_trace_get_alloc_sbi,
57 	afs_volume_trace_get_cell_insert,
58 	afs_volume_trace_get_new_op,
59 	afs_volume_trace_get_query_alias,
60 	afs_volume_trace_put_cell_dup,
61 	afs_volume_trace_put_cell_root,
62 	afs_volume_trace_put_destroy_sbi,
63 	afs_volume_trace_put_free_fc,
64 	afs_volume_trace_put_put_op,
65 	afs_volume_trace_put_query_alias,
66 	afs_volume_trace_put_validate_fc,
67 	afs_volume_trace_remove,
68 };
69 
70 enum afs_fs_operation {
71 	afs_FS_FetchData		= 130,	/* AFS Fetch file data */
72 	afs_FS_FetchACL			= 131,	/* AFS Fetch file ACL */
73 	afs_FS_FetchStatus		= 132,	/* AFS Fetch file status */
74 	afs_FS_StoreData		= 133,	/* AFS Store file data */
75 	afs_FS_StoreACL			= 134,	/* AFS Store file ACL */
76 	afs_FS_StoreStatus		= 135,	/* AFS Store file status */
77 	afs_FS_RemoveFile		= 136,	/* AFS Remove a file */
78 	afs_FS_CreateFile		= 137,	/* AFS Create a file */
79 	afs_FS_Rename			= 138,	/* AFS Rename or move a file or directory */
80 	afs_FS_Symlink			= 139,	/* AFS Create a symbolic link */
81 	afs_FS_Link			= 140,	/* AFS Create a hard link */
82 	afs_FS_MakeDir			= 141,	/* AFS Create a directory */
83 	afs_FS_RemoveDir		= 142,	/* AFS Remove a directory */
84 	afs_FS_GetVolumeInfo		= 148,	/* AFS Get information about a volume */
85 	afs_FS_GetVolumeStatus		= 149,	/* AFS Get volume status information */
86 	afs_FS_GetRootVolume		= 151,	/* AFS Get root volume name */
87 	afs_FS_SetLock			= 156,	/* AFS Request a file lock */
88 	afs_FS_ExtendLock		= 157,	/* AFS Extend a file lock */
89 	afs_FS_ReleaseLock		= 158,	/* AFS Release a file lock */
90 	afs_FS_Lookup			= 161,	/* AFS lookup file in directory */
91 	afs_FS_InlineBulkStatus		= 65536, /* AFS Fetch multiple file statuses with errors */
92 	afs_FS_FetchData64		= 65537, /* AFS Fetch file data */
93 	afs_FS_StoreData64		= 65538, /* AFS Store file data */
94 	afs_FS_GiveUpAllCallBacks	= 65539, /* AFS Give up all our callbacks on a server */
95 	afs_FS_GetCapabilities		= 65540, /* AFS Get FS server capabilities */
96 
97 	yfs_FS_FetchData		= 130,	 /* YFS Fetch file data */
98 	yfs_FS_FetchACL			= 64131, /* YFS Fetch file ACL */
99 	yfs_FS_FetchStatus		= 64132, /* YFS Fetch file status */
100 	yfs_FS_StoreACL			= 64134, /* YFS Store file ACL */
101 	yfs_FS_StoreStatus		= 64135, /* YFS Store file status */
102 	yfs_FS_RemoveFile		= 64136, /* YFS Remove a file */
103 	yfs_FS_CreateFile		= 64137, /* YFS Create a file */
104 	yfs_FS_Rename			= 64138, /* YFS Rename or move a file or directory */
105 	yfs_FS_Symlink			= 64139, /* YFS Create a symbolic link */
106 	yfs_FS_Link			= 64140, /* YFS Create a hard link */
107 	yfs_FS_MakeDir			= 64141, /* YFS Create a directory */
108 	yfs_FS_RemoveDir		= 64142, /* YFS Remove a directory */
109 	yfs_FS_GetVolumeStatus		= 64149, /* YFS Get volume status information */
110 	yfs_FS_SetVolumeStatus		= 64150, /* YFS Set volume status information */
111 	yfs_FS_SetLock			= 64156, /* YFS Request a file lock */
112 	yfs_FS_ExtendLock		= 64157, /* YFS Extend a file lock */
113 	yfs_FS_ReleaseLock		= 64158, /* YFS Release a file lock */
114 	yfs_FS_Lookup			= 64161, /* YFS lookup file in directory */
115 	yfs_FS_FlushCPS			= 64165,
116 	yfs_FS_FetchOpaqueACL		= 64168,
117 	yfs_FS_WhoAmI			= 64170,
118 	yfs_FS_RemoveACL		= 64171,
119 	yfs_FS_RemoveFile2		= 64173,
120 	yfs_FS_StoreOpaqueACL2		= 64174,
121 	yfs_FS_InlineBulkStatus		= 64536, /* YFS Fetch multiple file statuses with errors */
122 	yfs_FS_FetchData64		= 64537, /* YFS Fetch file data */
123 	yfs_FS_StoreData64		= 64538, /* YFS Store file data */
124 	yfs_FS_UpdateSymlink		= 64540,
125 };
126 
127 enum afs_vl_operation {
128 	afs_VL_GetEntryByNameU	= 527,		/* AFS Get Vol Entry By Name operation ID */
129 	afs_VL_GetAddrsU	= 533,		/* AFS Get FS server addresses */
130 	afs_YFSVL_GetEndpoints	= 64002,	/* YFS Get FS & Vol server addresses */
131 	afs_YFSVL_GetCellName	= 64014,	/* YFS Get actual cell name */
132 	afs_VL_GetCapabilities	= 65537,	/* AFS Get VL server capabilities */
133 };
134 
135 enum afs_edit_dir_op {
136 	afs_edit_dir_create,
137 	afs_edit_dir_create_error,
138 	afs_edit_dir_create_inval,
139 	afs_edit_dir_create_nospc,
140 	afs_edit_dir_delete,
141 	afs_edit_dir_delete_error,
142 	afs_edit_dir_delete_inval,
143 	afs_edit_dir_delete_noent,
144 };
145 
146 enum afs_edit_dir_reason {
147 	afs_edit_dir_for_create,
148 	afs_edit_dir_for_link,
149 	afs_edit_dir_for_mkdir,
150 	afs_edit_dir_for_rename_0,
151 	afs_edit_dir_for_rename_1,
152 	afs_edit_dir_for_rename_2,
153 	afs_edit_dir_for_rmdir,
154 	afs_edit_dir_for_silly_0,
155 	afs_edit_dir_for_silly_1,
156 	afs_edit_dir_for_symlink,
157 	afs_edit_dir_for_unlink,
158 };
159 
160 enum afs_eproto_cause {
161 	afs_eproto_bad_status,
162 	afs_eproto_cb_count,
163 	afs_eproto_cb_fid_count,
164 	afs_eproto_cellname_len,
165 	afs_eproto_file_type,
166 	afs_eproto_ibulkst_cb_count,
167 	afs_eproto_ibulkst_count,
168 	afs_eproto_motd_len,
169 	afs_eproto_offline_msg_len,
170 	afs_eproto_volname_len,
171 	afs_eproto_yvl_fsendpt4_len,
172 	afs_eproto_yvl_fsendpt6_len,
173 	afs_eproto_yvl_fsendpt_num,
174 	afs_eproto_yvl_fsendpt_type,
175 	afs_eproto_yvl_vlendpt4_len,
176 	afs_eproto_yvl_vlendpt6_len,
177 	afs_eproto_yvl_vlendpt_type,
178 };
179 
180 enum afs_io_error {
181 	afs_io_error_cm_reply,
182 	afs_io_error_extract,
183 	afs_io_error_fs_probe_fail,
184 	afs_io_error_vl_lookup_fail,
185 	afs_io_error_vl_probe_fail,
186 };
187 
188 enum afs_file_error {
189 	afs_file_error_dir_bad_magic,
190 	afs_file_error_dir_big,
191 	afs_file_error_dir_missing_page,
192 	afs_file_error_dir_over_end,
193 	afs_file_error_dir_small,
194 	afs_file_error_dir_unmarked_ext,
195 	afs_file_error_mntpt,
196 	afs_file_error_writeback_fail,
197 };
198 
199 enum afs_flock_event {
200 	afs_flock_acquired,
201 	afs_flock_callback_break,
202 	afs_flock_defer_unlock,
203 	afs_flock_extend_fail,
204 	afs_flock_fail_other,
205 	afs_flock_fail_perm,
206 	afs_flock_no_lockers,
207 	afs_flock_release_fail,
208 	afs_flock_silly_delete,
209 	afs_flock_timestamp,
210 	afs_flock_try_to_lock,
211 	afs_flock_vfs_lock,
212 	afs_flock_vfs_locking,
213 	afs_flock_waited,
214 	afs_flock_waiting,
215 	afs_flock_work_extending,
216 	afs_flock_work_retry,
217 	afs_flock_work_unlocking,
218 	afs_flock_would_block,
219 };
220 
221 enum afs_flock_operation {
222 	afs_flock_op_copy_lock,
223 	afs_flock_op_flock,
224 	afs_flock_op_grant,
225 	afs_flock_op_lock,
226 	afs_flock_op_release_lock,
227 	afs_flock_op_return_ok,
228 	afs_flock_op_return_eagain,
229 	afs_flock_op_return_edeadlk,
230 	afs_flock_op_return_error,
231 	afs_flock_op_set_lock,
232 	afs_flock_op_unlock,
233 	afs_flock_op_wake,
234 };
235 
236 enum afs_cb_break_reason {
237 	afs_cb_break_no_break,
238 	afs_cb_break_for_callback,
239 	afs_cb_break_for_deleted,
240 	afs_cb_break_for_lapsed,
241 	afs_cb_break_for_unlink,
242 	afs_cb_break_for_vsbreak,
243 	afs_cb_break_for_volume_callback,
244 	afs_cb_break_for_zap,
245 };
246 
247 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
248 
249 /*
250  * Declare tracing information enums and their string mappings for display.
251  */
252 #define afs_call_traces \
253 	EM(afs_call_trace_alloc,		"ALLOC") \
254 	EM(afs_call_trace_free,			"FREE ") \
255 	EM(afs_call_trace_get,			"GET  ") \
256 	EM(afs_call_trace_put,			"PUT  ") \
257 	EM(afs_call_trace_wake,			"WAKE ") \
258 	E_(afs_call_trace_work,			"QUEUE")
259 
260 #define afs_server_traces \
261 	EM(afs_server_trace_alloc,		"ALLOC    ") \
262 	EM(afs_server_trace_callback,		"CALLBACK ") \
263 	EM(afs_server_trace_destroy,		"DESTROY  ") \
264 	EM(afs_server_trace_free,		"FREE     ") \
265 	EM(afs_server_trace_gc,			"GC       ") \
266 	EM(afs_server_trace_get_by_addr,	"GET addr ") \
267 	EM(afs_server_trace_get_by_uuid,	"GET uuid ") \
268 	EM(afs_server_trace_get_caps,		"GET caps ") \
269 	EM(afs_server_trace_get_install,	"GET inst ") \
270 	EM(afs_server_trace_get_new_cbi,	"GET cbi  ") \
271 	EM(afs_server_trace_get_probe,		"GET probe") \
272 	EM(afs_server_trace_give_up_cb,		"giveup-cb") \
273 	EM(afs_server_trace_put_call,		"PUT call ") \
274 	EM(afs_server_trace_put_cbi,		"PUT cbi  ") \
275 	EM(afs_server_trace_put_find_rsq,	"PUT f-rsq") \
276 	EM(afs_server_trace_put_probe,		"PUT probe") \
277 	EM(afs_server_trace_put_slist,		"PUT slist") \
278 	EM(afs_server_trace_put_slist_isort,	"PUT isort") \
279 	EM(afs_server_trace_put_uuid_rsq,	"PUT u-req") \
280 	E_(afs_server_trace_update,		"UPDATE")
281 
282 #define afs_volume_traces \
283 	EM(afs_volume_trace_alloc,		"ALLOC         ") \
284 	EM(afs_volume_trace_free,		"FREE          ") \
285 	EM(afs_volume_trace_get_alloc_sbi,	"GET sbi-alloc ") \
286 	EM(afs_volume_trace_get_cell_insert,	"GET cell-insrt") \
287 	EM(afs_volume_trace_get_new_op,		"GET op-new    ") \
288 	EM(afs_volume_trace_get_query_alias,	"GET cell-alias") \
289 	EM(afs_volume_trace_put_cell_dup,	"PUT cell-dup  ") \
290 	EM(afs_volume_trace_put_cell_root,	"PUT cell-root ") \
291 	EM(afs_volume_trace_put_destroy_sbi,	"PUT sbi-destry") \
292 	EM(afs_volume_trace_put_free_fc,	"PUT fc-free   ") \
293 	EM(afs_volume_trace_put_put_op,		"PUT op-put    ") \
294 	EM(afs_volume_trace_put_query_alias,	"PUT cell-alias") \
295 	EM(afs_volume_trace_put_validate_fc,	"PUT fc-validat") \
296 	E_(afs_volume_trace_remove,		"REMOVE        ")
297 
298 #define afs_fs_operations \
299 	EM(afs_FS_FetchData,			"FS.FetchData") \
300 	EM(afs_FS_FetchStatus,			"FS.FetchStatus") \
301 	EM(afs_FS_StoreData,			"FS.StoreData") \
302 	EM(afs_FS_StoreStatus,			"FS.StoreStatus") \
303 	EM(afs_FS_RemoveFile,			"FS.RemoveFile") \
304 	EM(afs_FS_CreateFile,			"FS.CreateFile") \
305 	EM(afs_FS_Rename,			"FS.Rename") \
306 	EM(afs_FS_Symlink,			"FS.Symlink") \
307 	EM(afs_FS_Link,				"FS.Link") \
308 	EM(afs_FS_MakeDir,			"FS.MakeDir") \
309 	EM(afs_FS_RemoveDir,			"FS.RemoveDir") \
310 	EM(afs_FS_GetVolumeInfo,		"FS.GetVolumeInfo") \
311 	EM(afs_FS_GetVolumeStatus,		"FS.GetVolumeStatus") \
312 	EM(afs_FS_GetRootVolume,		"FS.GetRootVolume") \
313 	EM(afs_FS_SetLock,			"FS.SetLock") \
314 	EM(afs_FS_ExtendLock,			"FS.ExtendLock") \
315 	EM(afs_FS_ReleaseLock,			"FS.ReleaseLock") \
316 	EM(afs_FS_Lookup,			"FS.Lookup") \
317 	EM(afs_FS_InlineBulkStatus,		"FS.InlineBulkStatus") \
318 	EM(afs_FS_FetchData64,			"FS.FetchData64") \
319 	EM(afs_FS_StoreData64,			"FS.StoreData64") \
320 	EM(afs_FS_GiveUpAllCallBacks,		"FS.GiveUpAllCallBacks") \
321 	EM(afs_FS_GetCapabilities,		"FS.GetCapabilities") \
322 	EM(yfs_FS_FetchACL,			"YFS.FetchACL") \
323 	EM(yfs_FS_FetchStatus,			"YFS.FetchStatus") \
324 	EM(yfs_FS_StoreACL,			"YFS.StoreACL") \
325 	EM(yfs_FS_StoreStatus,			"YFS.StoreStatus") \
326 	EM(yfs_FS_RemoveFile,			"YFS.RemoveFile") \
327 	EM(yfs_FS_CreateFile,			"YFS.CreateFile") \
328 	EM(yfs_FS_Rename,			"YFS.Rename") \
329 	EM(yfs_FS_Symlink,			"YFS.Symlink") \
330 	EM(yfs_FS_Link,				"YFS.Link") \
331 	EM(yfs_FS_MakeDir,			"YFS.MakeDir") \
332 	EM(yfs_FS_RemoveDir,			"YFS.RemoveDir") \
333 	EM(yfs_FS_GetVolumeStatus,		"YFS.GetVolumeStatus") \
334 	EM(yfs_FS_SetVolumeStatus,		"YFS.SetVolumeStatus") \
335 	EM(yfs_FS_SetLock,			"YFS.SetLock") \
336 	EM(yfs_FS_ExtendLock,			"YFS.ExtendLock") \
337 	EM(yfs_FS_ReleaseLock,			"YFS.ReleaseLock") \
338 	EM(yfs_FS_Lookup,			"YFS.Lookup") \
339 	EM(yfs_FS_FlushCPS,			"YFS.FlushCPS") \
340 	EM(yfs_FS_FetchOpaqueACL,		"YFS.FetchOpaqueACL") \
341 	EM(yfs_FS_WhoAmI,			"YFS.WhoAmI") \
342 	EM(yfs_FS_RemoveACL,			"YFS.RemoveACL") \
343 	EM(yfs_FS_RemoveFile2,			"YFS.RemoveFile2") \
344 	EM(yfs_FS_StoreOpaqueACL2,		"YFS.StoreOpaqueACL2") \
345 	EM(yfs_FS_InlineBulkStatus,		"YFS.InlineBulkStatus") \
346 	EM(yfs_FS_FetchData64,			"YFS.FetchData64") \
347 	EM(yfs_FS_StoreData64,			"YFS.StoreData64") \
348 	E_(yfs_FS_UpdateSymlink,		"YFS.UpdateSymlink")
349 
350 #define afs_vl_operations \
351 	EM(afs_VL_GetEntryByNameU,		"VL.GetEntryByNameU") \
352 	EM(afs_VL_GetAddrsU,			"VL.GetAddrsU") \
353 	EM(afs_YFSVL_GetEndpoints,		"YFSVL.GetEndpoints") \
354 	EM(afs_YFSVL_GetCellName,		"YFSVL.GetCellName") \
355 	E_(afs_VL_GetCapabilities,		"VL.GetCapabilities")
356 
357 #define afs_edit_dir_ops				  \
358 	EM(afs_edit_dir_create,			"create") \
359 	EM(afs_edit_dir_create_error,		"c_fail") \
360 	EM(afs_edit_dir_create_inval,		"c_invl") \
361 	EM(afs_edit_dir_create_nospc,		"c_nspc") \
362 	EM(afs_edit_dir_delete,			"delete") \
363 	EM(afs_edit_dir_delete_error,		"d_err ") \
364 	EM(afs_edit_dir_delete_inval,		"d_invl") \
365 	E_(afs_edit_dir_delete_noent,		"d_nent")
366 
367 #define afs_edit_dir_reasons				  \
368 	EM(afs_edit_dir_for_create,		"Create") \
369 	EM(afs_edit_dir_for_link,		"Link  ") \
370 	EM(afs_edit_dir_for_mkdir,		"MkDir ") \
371 	EM(afs_edit_dir_for_rename_0,		"Renam0") \
372 	EM(afs_edit_dir_for_rename_1,		"Renam1") \
373 	EM(afs_edit_dir_for_rename_2,		"Renam2") \
374 	EM(afs_edit_dir_for_rmdir,		"RmDir ") \
375 	EM(afs_edit_dir_for_silly_0,		"S_Ren0") \
376 	EM(afs_edit_dir_for_silly_1,		"S_Ren1") \
377 	EM(afs_edit_dir_for_symlink,		"Symlnk") \
378 	E_(afs_edit_dir_for_unlink,		"Unlink")
379 
380 #define afs_eproto_causes			\
381 	EM(afs_eproto_bad_status,	"BadStatus") \
382 	EM(afs_eproto_cb_count,		"CbCount") \
383 	EM(afs_eproto_cb_fid_count,	"CbFidCount") \
384 	EM(afs_eproto_cellname_len,	"CellNameLen") \
385 	EM(afs_eproto_file_type,	"FileTYpe") \
386 	EM(afs_eproto_ibulkst_cb_count,	"IBS.CbCount") \
387 	EM(afs_eproto_ibulkst_count,	"IBS.FidCount") \
388 	EM(afs_eproto_motd_len,		"MotdLen") \
389 	EM(afs_eproto_offline_msg_len,	"OfflineMsgLen") \
390 	EM(afs_eproto_volname_len,	"VolNameLen") \
391 	EM(afs_eproto_yvl_fsendpt4_len,	"YVL.FsEnd4Len") \
392 	EM(afs_eproto_yvl_fsendpt6_len,	"YVL.FsEnd6Len") \
393 	EM(afs_eproto_yvl_fsendpt_num,	"YVL.FsEndCount") \
394 	EM(afs_eproto_yvl_fsendpt_type,	"YVL.FsEndType") \
395 	EM(afs_eproto_yvl_vlendpt4_len,	"YVL.VlEnd4Len") \
396 	EM(afs_eproto_yvl_vlendpt6_len,	"YVL.VlEnd6Len") \
397 	E_(afs_eproto_yvl_vlendpt_type,	"YVL.VlEndType")
398 
399 #define afs_io_errors							\
400 	EM(afs_io_error_cm_reply,		"CM_REPLY")		\
401 	EM(afs_io_error_extract,		"EXTRACT")		\
402 	EM(afs_io_error_fs_probe_fail,		"FS_PROBE_FAIL")	\
403 	EM(afs_io_error_vl_lookup_fail,		"VL_LOOKUP_FAIL")	\
404 	E_(afs_io_error_vl_probe_fail,		"VL_PROBE_FAIL")
405 
406 #define afs_file_errors							\
407 	EM(afs_file_error_dir_bad_magic,	"DIR_BAD_MAGIC")	\
408 	EM(afs_file_error_dir_big,		"DIR_BIG")		\
409 	EM(afs_file_error_dir_missing_page,	"DIR_MISSING_PAGE")	\
410 	EM(afs_file_error_dir_over_end,		"DIR_ENT_OVER_END")	\
411 	EM(afs_file_error_dir_small,		"DIR_SMALL")		\
412 	EM(afs_file_error_dir_unmarked_ext,	"DIR_UNMARKED_EXT")	\
413 	EM(afs_file_error_mntpt,		"MNTPT_READ_FAILED")	\
414 	E_(afs_file_error_writeback_fail,	"WRITEBACK_FAILED")
415 
416 #define afs_flock_types							\
417 	EM(F_RDLCK,				"RDLCK")		\
418 	EM(F_WRLCK,				"WRLCK")		\
419 	E_(F_UNLCK,				"UNLCK")
420 
421 #define afs_flock_states						\
422 	EM(AFS_VNODE_LOCK_NONE,			"NONE")			\
423 	EM(AFS_VNODE_LOCK_WAITING_FOR_CB,	"WAIT_FOR_CB")		\
424 	EM(AFS_VNODE_LOCK_SETTING,		"SETTING")		\
425 	EM(AFS_VNODE_LOCK_GRANTED,		"GRANTED")		\
426 	EM(AFS_VNODE_LOCK_EXTENDING,		"EXTENDING")		\
427 	EM(AFS_VNODE_LOCK_NEED_UNLOCK,		"NEED_UNLOCK")		\
428 	EM(AFS_VNODE_LOCK_UNLOCKING,		"UNLOCKING")		\
429 	E_(AFS_VNODE_LOCK_DELETED,		"DELETED")
430 
431 #define afs_flock_events						\
432 	EM(afs_flock_acquired,			"Acquired")		\
433 	EM(afs_flock_callback_break,		"Callback")		\
434 	EM(afs_flock_defer_unlock,		"D-Unlock")		\
435 	EM(afs_flock_extend_fail,		"Ext_Fail")		\
436 	EM(afs_flock_fail_other,		"ErrOther")		\
437 	EM(afs_flock_fail_perm,			"ErrPerm ")		\
438 	EM(afs_flock_no_lockers,		"NoLocker")		\
439 	EM(afs_flock_release_fail,		"Rel_Fail")		\
440 	EM(afs_flock_silly_delete,		"SillyDel")		\
441 	EM(afs_flock_timestamp,			"Timestmp")		\
442 	EM(afs_flock_try_to_lock,		"TryToLck")		\
443 	EM(afs_flock_vfs_lock,			"VFSLock ")		\
444 	EM(afs_flock_vfs_locking,		"VFSLking")		\
445 	EM(afs_flock_waited,			"Waited  ")		\
446 	EM(afs_flock_waiting,			"Waiting ")		\
447 	EM(afs_flock_work_extending,		"Extendng")		\
448 	EM(afs_flock_work_retry,		"Retry   ")		\
449 	EM(afs_flock_work_unlocking,		"Unlcking")		\
450 	E_(afs_flock_would_block,		"EWOULDBL")
451 
452 #define afs_flock_operations						\
453 	EM(afs_flock_op_copy_lock,		"COPY    ")		\
454 	EM(afs_flock_op_flock,			"->flock ")		\
455 	EM(afs_flock_op_grant,			"GRANT   ")		\
456 	EM(afs_flock_op_lock,			"->lock  ")		\
457 	EM(afs_flock_op_release_lock,		"RELEASE ")		\
458 	EM(afs_flock_op_return_ok,		"<-OK    ")		\
459 	EM(afs_flock_op_return_edeadlk,		"<-EDEADL")		\
460 	EM(afs_flock_op_return_eagain,		"<-EAGAIN")		\
461 	EM(afs_flock_op_return_error,		"<-ERROR ")		\
462 	EM(afs_flock_op_set_lock,		"SET     ")		\
463 	EM(afs_flock_op_unlock,			"UNLOCK  ")		\
464 	E_(afs_flock_op_wake,			"WAKE    ")
465 
466 #define afs_cb_break_reasons						\
467 	EM(afs_cb_break_no_break,		"no-break")		\
468 	EM(afs_cb_break_for_callback,		"break-cb")		\
469 	EM(afs_cb_break_for_deleted,		"break-del")		\
470 	EM(afs_cb_break_for_lapsed,		"break-lapsed")		\
471 	EM(afs_cb_break_for_unlink,		"break-unlink")		\
472 	EM(afs_cb_break_for_vsbreak,		"break-vs")		\
473 	EM(afs_cb_break_for_volume_callback,	"break-v-cb")		\
474 	E_(afs_cb_break_for_zap,		"break-zap")
475 
476 /*
477  * Export enum symbols via userspace.
478  */
479 #undef EM
480 #undef E_
481 #define EM(a, b) TRACE_DEFINE_ENUM(a);
482 #define E_(a, b) TRACE_DEFINE_ENUM(a);
483 
484 afs_call_traces;
485 afs_server_traces;
486 afs_fs_operations;
487 afs_vl_operations;
488 afs_edit_dir_ops;
489 afs_edit_dir_reasons;
490 afs_eproto_causes;
491 afs_io_errors;
492 afs_file_errors;
493 afs_flock_types;
494 afs_flock_operations;
495 afs_cb_break_reasons;
496 
497 /*
498  * Now redefine the EM() and E_() macros to map the enums to the strings that
499  * will be printed in the output.
500  */
501 #undef EM
502 #undef E_
503 #define EM(a, b)	{ a, b },
504 #define E_(a, b)	{ a, b }
505 
506 TRACE_EVENT(afs_receive_data,
507 	    TP_PROTO(struct afs_call *call, struct iov_iter *iter,
508 		     bool want_more, int ret),
509 
510 	    TP_ARGS(call, iter, want_more, ret),
511 
512 	    TP_STRUCT__entry(
513 		    __field(loff_t,			remain		)
514 		    __field(unsigned int,		call		)
515 		    __field(enum afs_call_state,	state		)
516 		    __field(unsigned short,		unmarshall	)
517 		    __field(bool,			want_more	)
518 		    __field(int,			ret		)
519 			     ),
520 
521 	    TP_fast_assign(
522 		    __entry->call	= call->debug_id;
523 		    __entry->state	= call->state;
524 		    __entry->unmarshall	= call->unmarshall;
525 		    __entry->remain	= iov_iter_count(iter);
526 		    __entry->want_more	= want_more;
527 		    __entry->ret	= ret;
528 			   ),
529 
530 	    TP_printk("c=%08x r=%llu u=%u w=%u s=%u ret=%d",
531 		      __entry->call,
532 		      __entry->remain,
533 		      __entry->unmarshall,
534 		      __entry->want_more,
535 		      __entry->state,
536 		      __entry->ret)
537 	    );
538 
539 TRACE_EVENT(afs_notify_call,
540 	    TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
541 
542 	    TP_ARGS(rxcall, call),
543 
544 	    TP_STRUCT__entry(
545 		    __field(unsigned int,		call		)
546 		    __field(enum afs_call_state,	state		)
547 		    __field(unsigned short,		unmarshall	)
548 			     ),
549 
550 	    TP_fast_assign(
551 		    __entry->call	= call->debug_id;
552 		    __entry->state	= call->state;
553 		    __entry->unmarshall	= call->unmarshall;
554 			   ),
555 
556 	    TP_printk("c=%08x s=%u u=%u",
557 		      __entry->call,
558 		      __entry->state, __entry->unmarshall)
559 	    );
560 
561 TRACE_EVENT(afs_cb_call,
562 	    TP_PROTO(struct afs_call *call),
563 
564 	    TP_ARGS(call),
565 
566 	    TP_STRUCT__entry(
567 		    __field(unsigned int,		call		)
568 		    __field(const char *,		name		)
569 		    __field(u32,			op		)
570 			     ),
571 
572 	    TP_fast_assign(
573 		    __entry->call	= call->debug_id;
574 		    __entry->name	= call->type->name;
575 		    __entry->op		= call->operation_ID;
576 			   ),
577 
578 	    TP_printk("c=%08x %s o=%u",
579 		      __entry->call,
580 		      __entry->name,
581 		      __entry->op)
582 	    );
583 
584 TRACE_EVENT(afs_call,
585 	    TP_PROTO(struct afs_call *call, enum afs_call_trace op,
586 		     int usage, int outstanding, const void *where),
587 
588 	    TP_ARGS(call, op, usage, outstanding, where),
589 
590 	    TP_STRUCT__entry(
591 		    __field(unsigned int,		call		)
592 		    __field(int,			op		)
593 		    __field(int,			usage		)
594 		    __field(int,			outstanding	)
595 		    __field(const void *,		where		)
596 			     ),
597 
598 	    TP_fast_assign(
599 		    __entry->call = call->debug_id;
600 		    __entry->op = op;
601 		    __entry->usage = usage;
602 		    __entry->outstanding = outstanding;
603 		    __entry->where = where;
604 			   ),
605 
606 	    TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
607 		      __entry->call,
608 		      __print_symbolic(__entry->op, afs_call_traces),
609 		      __entry->usage,
610 		      __entry->outstanding,
611 		      __entry->where)
612 	    );
613 
614 TRACE_EVENT(afs_make_fs_call,
615 	    TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
616 
617 	    TP_ARGS(call, fid),
618 
619 	    TP_STRUCT__entry(
620 		    __field(unsigned int,		call		)
621 		    __field(enum afs_fs_operation,	op		)
622 		    __field_struct(struct afs_fid,	fid		)
623 			     ),
624 
625 	    TP_fast_assign(
626 		    __entry->call = call->debug_id;
627 		    __entry->op = call->operation_ID;
628 		    if (fid) {
629 			    __entry->fid = *fid;
630 		    } else {
631 			    __entry->fid.vid = 0;
632 			    __entry->fid.vnode = 0;
633 			    __entry->fid.unique = 0;
634 		    }
635 			   ),
636 
637 	    TP_printk("c=%08x %06llx:%06llx:%06x %s",
638 		      __entry->call,
639 		      __entry->fid.vid,
640 		      __entry->fid.vnode,
641 		      __entry->fid.unique,
642 		      __print_symbolic(__entry->op, afs_fs_operations))
643 	    );
644 
645 TRACE_EVENT(afs_make_fs_calli,
646 	    TP_PROTO(struct afs_call *call, const struct afs_fid *fid,
647 		     unsigned int i),
648 
649 	    TP_ARGS(call, fid, i),
650 
651 	    TP_STRUCT__entry(
652 		    __field(unsigned int,		call		)
653 		    __field(unsigned int,		i		)
654 		    __field(enum afs_fs_operation,	op		)
655 		    __field_struct(struct afs_fid,	fid		)
656 			     ),
657 
658 	    TP_fast_assign(
659 		    __entry->call = call->debug_id;
660 		    __entry->i = i;
661 		    __entry->op = call->operation_ID;
662 		    if (fid) {
663 			    __entry->fid = *fid;
664 		    } else {
665 			    __entry->fid.vid = 0;
666 			    __entry->fid.vnode = 0;
667 			    __entry->fid.unique = 0;
668 		    }
669 			   ),
670 
671 	    TP_printk("c=%08x %06llx:%06llx:%06x %s i=%u",
672 		      __entry->call,
673 		      __entry->fid.vid,
674 		      __entry->fid.vnode,
675 		      __entry->fid.unique,
676 		      __print_symbolic(__entry->op, afs_fs_operations),
677 		      __entry->i)
678 	    );
679 
680 TRACE_EVENT(afs_make_fs_call1,
681 	    TP_PROTO(struct afs_call *call, const struct afs_fid *fid,
682 		     const struct qstr *name),
683 
684 	    TP_ARGS(call, fid, name),
685 
686 	    TP_STRUCT__entry(
687 		    __field(unsigned int,		call		)
688 		    __field(enum afs_fs_operation,	op		)
689 		    __field_struct(struct afs_fid,	fid		)
690 		    __array(char,			name, 24	)
691 			     ),
692 
693 	    TP_fast_assign(
694 		    unsigned int __len = min_t(unsigned int, name->len, 23);
695 		    __entry->call = call->debug_id;
696 		    __entry->op = call->operation_ID;
697 		    if (fid) {
698 			    __entry->fid = *fid;
699 		    } else {
700 			    __entry->fid.vid = 0;
701 			    __entry->fid.vnode = 0;
702 			    __entry->fid.unique = 0;
703 		    }
704 		    memcpy(__entry->name, name->name, __len);
705 		    __entry->name[__len] = 0;
706 			   ),
707 
708 	    TP_printk("c=%08x %06llx:%06llx:%06x %s \"%s\"",
709 		      __entry->call,
710 		      __entry->fid.vid,
711 		      __entry->fid.vnode,
712 		      __entry->fid.unique,
713 		      __print_symbolic(__entry->op, afs_fs_operations),
714 		      __entry->name)
715 	    );
716 
717 TRACE_EVENT(afs_make_fs_call2,
718 	    TP_PROTO(struct afs_call *call, const struct afs_fid *fid,
719 		     const struct qstr *name, const struct qstr *name2),
720 
721 	    TP_ARGS(call, fid, name, name2),
722 
723 	    TP_STRUCT__entry(
724 		    __field(unsigned int,		call		)
725 		    __field(enum afs_fs_operation,	op		)
726 		    __field_struct(struct afs_fid,	fid		)
727 		    __array(char,			name, 24	)
728 		    __array(char,			name2, 24	)
729 			     ),
730 
731 	    TP_fast_assign(
732 		    unsigned int __len = min_t(unsigned int, name->len, 23);
733 		    unsigned int __len2 = min_t(unsigned int, name2->len, 23);
734 		    __entry->call = call->debug_id;
735 		    __entry->op = call->operation_ID;
736 		    if (fid) {
737 			    __entry->fid = *fid;
738 		    } else {
739 			    __entry->fid.vid = 0;
740 			    __entry->fid.vnode = 0;
741 			    __entry->fid.unique = 0;
742 		    }
743 		    memcpy(__entry->name, name->name, __len);
744 		    __entry->name[__len] = 0;
745 		    memcpy(__entry->name2, name2->name, __len2);
746 		    __entry->name2[__len2] = 0;
747 			   ),
748 
749 	    TP_printk("c=%08x %06llx:%06llx:%06x %s \"%s\" \"%s\"",
750 		      __entry->call,
751 		      __entry->fid.vid,
752 		      __entry->fid.vnode,
753 		      __entry->fid.unique,
754 		      __print_symbolic(__entry->op, afs_fs_operations),
755 		      __entry->name,
756 		      __entry->name2)
757 	    );
758 
759 TRACE_EVENT(afs_make_vl_call,
760 	    TP_PROTO(struct afs_call *call),
761 
762 	    TP_ARGS(call),
763 
764 	    TP_STRUCT__entry(
765 		    __field(unsigned int,		call		)
766 		    __field(enum afs_vl_operation,	op		)
767 			     ),
768 
769 	    TP_fast_assign(
770 		    __entry->call = call->debug_id;
771 		    __entry->op = call->operation_ID;
772 			   ),
773 
774 	    TP_printk("c=%08x %s",
775 		      __entry->call,
776 		      __print_symbolic(__entry->op, afs_vl_operations))
777 	    );
778 
779 TRACE_EVENT(afs_call_done,
780 	    TP_PROTO(struct afs_call *call),
781 
782 	    TP_ARGS(call),
783 
784 	    TP_STRUCT__entry(
785 		    __field(unsigned int,		call		)
786 		    __field(struct rxrpc_call *,	rx_call		)
787 		    __field(int,			ret		)
788 		    __field(u32,			abort_code	)
789 			     ),
790 
791 	    TP_fast_assign(
792 		    __entry->call = call->debug_id;
793 		    __entry->rx_call = call->rxcall;
794 		    __entry->ret = call->error;
795 		    __entry->abort_code = call->abort_code;
796 			   ),
797 
798 	    TP_printk("   c=%08x ret=%d ab=%d [%p]",
799 		      __entry->call,
800 		      __entry->ret,
801 		      __entry->abort_code,
802 		      __entry->rx_call)
803 	    );
804 
805 TRACE_EVENT(afs_send_pages,
806 	    TP_PROTO(struct afs_call *call, struct msghdr *msg,
807 		     pgoff_t first, pgoff_t last, unsigned int offset),
808 
809 	    TP_ARGS(call, msg, first, last, offset),
810 
811 	    TP_STRUCT__entry(
812 		    __field(unsigned int,		call		)
813 		    __field(pgoff_t,			first		)
814 		    __field(pgoff_t,			last		)
815 		    __field(unsigned int,		nr		)
816 		    __field(unsigned int,		bytes		)
817 		    __field(unsigned int,		offset		)
818 		    __field(unsigned int,		flags		)
819 			     ),
820 
821 	    TP_fast_assign(
822 		    __entry->call = call->debug_id;
823 		    __entry->first = first;
824 		    __entry->last = last;
825 		    __entry->nr = msg->msg_iter.nr_segs;
826 		    __entry->bytes = msg->msg_iter.count;
827 		    __entry->offset = offset;
828 		    __entry->flags = msg->msg_flags;
829 			   ),
830 
831 	    TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
832 		      __entry->call,
833 		      __entry->first, __entry->first + __entry->nr - 1, __entry->last,
834 		      __entry->bytes, __entry->offset,
835 		      __entry->flags)
836 	    );
837 
838 TRACE_EVENT(afs_sent_pages,
839 	    TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
840 		     pgoff_t cursor, int ret),
841 
842 	    TP_ARGS(call, first, last, cursor, ret),
843 
844 	    TP_STRUCT__entry(
845 		    __field(unsigned int,		call		)
846 		    __field(pgoff_t,			first		)
847 		    __field(pgoff_t,			last		)
848 		    __field(pgoff_t,			cursor		)
849 		    __field(int,			ret		)
850 			     ),
851 
852 	    TP_fast_assign(
853 		    __entry->call = call->debug_id;
854 		    __entry->first = first;
855 		    __entry->last = last;
856 		    __entry->cursor = cursor;
857 		    __entry->ret = ret;
858 			   ),
859 
860 	    TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
861 		      __entry->call,
862 		      __entry->first, __entry->last,
863 		      __entry->cursor, __entry->ret)
864 	    );
865 
866 TRACE_EVENT(afs_dir_check_failed,
867 	    TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
868 
869 	    TP_ARGS(vnode, off, i_size),
870 
871 	    TP_STRUCT__entry(
872 		    __field(struct afs_vnode *,		vnode		)
873 		    __field(loff_t,			off		)
874 		    __field(loff_t,			i_size		)
875 			     ),
876 
877 	    TP_fast_assign(
878 		    __entry->vnode = vnode;
879 		    __entry->off = off;
880 		    __entry->i_size = i_size;
881 			   ),
882 
883 	    TP_printk("vn=%p %llx/%llx",
884 		      __entry->vnode, __entry->off, __entry->i_size)
885 	    );
886 
887 /*
888  * We use page->private to hold the amount of the page that we've written to,
889  * splitting the field into two parts.  However, we need to represent a range
890  * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
891  */
892 #if PAGE_SIZE > 32768
893 #define AFS_PRIV_MAX	0xffffffff
894 #define AFS_PRIV_SHIFT	32
895 #else
896 #define AFS_PRIV_MAX	0xffff
897 #define AFS_PRIV_SHIFT	16
898 #endif
899 
900 TRACE_EVENT(afs_page_dirty,
901 	    TP_PROTO(struct afs_vnode *vnode, const char *where,
902 		     pgoff_t page, unsigned long priv),
903 
904 	    TP_ARGS(vnode, where, page, priv),
905 
906 	    TP_STRUCT__entry(
907 		    __field(struct afs_vnode *,		vnode		)
908 		    __field(const char *,		where		)
909 		    __field(pgoff_t,			page		)
910 		    __field(unsigned long,		priv		)
911 			     ),
912 
913 	    TP_fast_assign(
914 		    __entry->vnode = vnode;
915 		    __entry->where = where;
916 		    __entry->page = page;
917 		    __entry->priv = priv;
918 			   ),
919 
920 	    TP_printk("vn=%p %lx %s %lu-%lu",
921 		      __entry->vnode, __entry->page, __entry->where,
922 		      __entry->priv & AFS_PRIV_MAX,
923 		      __entry->priv >> AFS_PRIV_SHIFT)
924 	    );
925 
926 TRACE_EVENT(afs_call_state,
927 	    TP_PROTO(struct afs_call *call,
928 		     enum afs_call_state from,
929 		     enum afs_call_state to,
930 		     int ret, u32 remote_abort),
931 
932 	    TP_ARGS(call, from, to, ret, remote_abort),
933 
934 	    TP_STRUCT__entry(
935 		    __field(unsigned int,		call		)
936 		    __field(enum afs_call_state,	from		)
937 		    __field(enum afs_call_state,	to		)
938 		    __field(int,			ret		)
939 		    __field(u32,			abort		)
940 			     ),
941 
942 	    TP_fast_assign(
943 		    __entry->call = call->debug_id;
944 		    __entry->from = from;
945 		    __entry->to = to;
946 		    __entry->ret = ret;
947 		    __entry->abort = remote_abort;
948 			   ),
949 
950 	    TP_printk("c=%08x %u->%u r=%d ab=%d",
951 		      __entry->call,
952 		      __entry->from, __entry->to,
953 		      __entry->ret, __entry->abort)
954 	    );
955 
956 TRACE_EVENT(afs_lookup,
957 	    TP_PROTO(struct afs_vnode *dvnode, const struct qstr *name,
958 		     struct afs_fid *fid),
959 
960 	    TP_ARGS(dvnode, name, fid),
961 
962 	    TP_STRUCT__entry(
963 		    __field_struct(struct afs_fid,	dfid		)
964 		    __field_struct(struct afs_fid,	fid		)
965 		    __array(char,			name, 24	)
966 			     ),
967 
968 	    TP_fast_assign(
969 		    int __len = min_t(int, name->len, 23);
970 		    __entry->dfid = dvnode->fid;
971 		    __entry->fid = *fid;
972 		    memcpy(__entry->name, name->name, __len);
973 		    __entry->name[__len] = 0;
974 			   ),
975 
976 	    TP_printk("d=%llx:%llx:%x \"%s\" f=%llx:%x",
977 		      __entry->dfid.vid, __entry->dfid.vnode, __entry->dfid.unique,
978 		      __entry->name,
979 		      __entry->fid.vnode, __entry->fid.unique)
980 	    );
981 
982 TRACE_EVENT(afs_edit_dir,
983 	    TP_PROTO(struct afs_vnode *dvnode,
984 		     enum afs_edit_dir_reason why,
985 		     enum afs_edit_dir_op op,
986 		     unsigned int block,
987 		     unsigned int slot,
988 		     unsigned int f_vnode,
989 		     unsigned int f_unique,
990 		     const char *name),
991 
992 	    TP_ARGS(dvnode, why, op, block, slot, f_vnode, f_unique, name),
993 
994 	    TP_STRUCT__entry(
995 		    __field(unsigned int,		vnode		)
996 		    __field(unsigned int,		unique		)
997 		    __field(enum afs_edit_dir_reason,	why		)
998 		    __field(enum afs_edit_dir_op,	op		)
999 		    __field(unsigned int,		block		)
1000 		    __field(unsigned short,		slot		)
1001 		    __field(unsigned int,		f_vnode		)
1002 		    __field(unsigned int,		f_unique	)
1003 		    __array(char,			name, 24	)
1004 			     ),
1005 
1006 	    TP_fast_assign(
1007 		    int __len = strlen(name);
1008 		    __len = min(__len, 23);
1009 		    __entry->vnode	= dvnode->fid.vnode;
1010 		    __entry->unique	= dvnode->fid.unique;
1011 		    __entry->why	= why;
1012 		    __entry->op		= op;
1013 		    __entry->block	= block;
1014 		    __entry->slot	= slot;
1015 		    __entry->f_vnode	= f_vnode;
1016 		    __entry->f_unique	= f_unique;
1017 		    memcpy(__entry->name, name, __len);
1018 		    __entry->name[__len] = 0;
1019 			   ),
1020 
1021 	    TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x \"%s\"",
1022 		      __entry->vnode, __entry->unique,
1023 		      __print_symbolic(__entry->why, afs_edit_dir_reasons),
1024 		      __print_symbolic(__entry->op, afs_edit_dir_ops),
1025 		      __entry->block, __entry->slot,
1026 		      __entry->f_vnode, __entry->f_unique,
1027 		      __entry->name)
1028 	    );
1029 
1030 TRACE_EVENT(afs_protocol_error,
1031 	    TP_PROTO(struct afs_call *call, enum afs_eproto_cause cause),
1032 
1033 	    TP_ARGS(call, cause),
1034 
1035 	    TP_STRUCT__entry(
1036 		    __field(unsigned int,		call		)
1037 		    __field(enum afs_eproto_cause,	cause		)
1038 			     ),
1039 
1040 	    TP_fast_assign(
1041 		    __entry->call = call ? call->debug_id : 0;
1042 		    __entry->cause = cause;
1043 			   ),
1044 
1045 	    TP_printk("c=%08x %s",
1046 		      __entry->call,
1047 		      __print_symbolic(__entry->cause, afs_eproto_causes))
1048 	    );
1049 
1050 TRACE_EVENT(afs_io_error,
1051 	    TP_PROTO(unsigned int call, int error, enum afs_io_error where),
1052 
1053 	    TP_ARGS(call, error, where),
1054 
1055 	    TP_STRUCT__entry(
1056 		    __field(unsigned int,	call		)
1057 		    __field(int,		error		)
1058 		    __field(enum afs_io_error,	where		)
1059 			     ),
1060 
1061 	    TP_fast_assign(
1062 		    __entry->call = call;
1063 		    __entry->error = error;
1064 		    __entry->where = where;
1065 			   ),
1066 
1067 	    TP_printk("c=%08x r=%d %s",
1068 		      __entry->call, __entry->error,
1069 		      __print_symbolic(__entry->where, afs_io_errors))
1070 	    );
1071 
1072 TRACE_EVENT(afs_file_error,
1073 	    TP_PROTO(struct afs_vnode *vnode, int error, enum afs_file_error where),
1074 
1075 	    TP_ARGS(vnode, error, where),
1076 
1077 	    TP_STRUCT__entry(
1078 		    __field_struct(struct afs_fid,	fid		)
1079 		    __field(int,			error		)
1080 		    __field(enum afs_file_error,	where		)
1081 			     ),
1082 
1083 	    TP_fast_assign(
1084 		    __entry->fid = vnode->fid;
1085 		    __entry->error = error;
1086 		    __entry->where = where;
1087 			   ),
1088 
1089 	    TP_printk("%llx:%llx:%x r=%d %s",
1090 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
1091 		      __entry->error,
1092 		      __print_symbolic(__entry->where, afs_file_errors))
1093 	    );
1094 
1095 TRACE_EVENT(afs_cm_no_server,
1096 	    TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx),
1097 
1098 	    TP_ARGS(call, srx),
1099 
1100 	    TP_STRUCT__entry(
1101 		    __field(unsigned int,			call	)
1102 		    __field(unsigned int,			op_id	)
1103 		    __field_struct(struct sockaddr_rxrpc,	srx	)
1104 			     ),
1105 
1106 	    TP_fast_assign(
1107 		    __entry->call = call->debug_id;
1108 		    __entry->op_id = call->operation_ID;
1109 		    memcpy(&__entry->srx, srx, sizeof(__entry->srx));
1110 			   ),
1111 
1112 	    TP_printk("c=%08x op=%u %pISpc",
1113 		      __entry->call, __entry->op_id, &__entry->srx.transport)
1114 	    );
1115 
1116 TRACE_EVENT(afs_cm_no_server_u,
1117 	    TP_PROTO(struct afs_call *call, const uuid_t *uuid),
1118 
1119 	    TP_ARGS(call, uuid),
1120 
1121 	    TP_STRUCT__entry(
1122 		    __field(unsigned int,			call	)
1123 		    __field(unsigned int,			op_id	)
1124 		    __field_struct(uuid_t,			uuid	)
1125 			     ),
1126 
1127 	    TP_fast_assign(
1128 		    __entry->call = call->debug_id;
1129 		    __entry->op_id = call->operation_ID;
1130 		    memcpy(&__entry->uuid, uuid, sizeof(__entry->uuid));
1131 			   ),
1132 
1133 	    TP_printk("c=%08x op=%u %pU",
1134 		      __entry->call, __entry->op_id, &__entry->uuid)
1135 	    );
1136 
1137 TRACE_EVENT(afs_flock_ev,
1138 	    TP_PROTO(struct afs_vnode *vnode, struct file_lock *fl,
1139 		     enum afs_flock_event event, int error),
1140 
1141 	    TP_ARGS(vnode, fl, event, error),
1142 
1143 	    TP_STRUCT__entry(
1144 		    __field_struct(struct afs_fid,	fid		)
1145 		    __field(enum afs_flock_event,	event		)
1146 		    __field(enum afs_lock_state,	state		)
1147 		    __field(int,			error		)
1148 		    __field(unsigned int,		debug_id	)
1149 			     ),
1150 
1151 	    TP_fast_assign(
1152 		    __entry->fid = vnode->fid;
1153 		    __entry->event = event;
1154 		    __entry->state = vnode->lock_state;
1155 		    __entry->error = error;
1156 		    __entry->debug_id = fl ? fl->fl_u.afs.debug_id : 0;
1157 			   ),
1158 
1159 	    TP_printk("%llx:%llx:%x %04x %s s=%s e=%d",
1160 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
1161 		      __entry->debug_id,
1162 		      __print_symbolic(__entry->event, afs_flock_events),
1163 		      __print_symbolic(__entry->state, afs_flock_states),
1164 		      __entry->error)
1165 	    );
1166 
1167 TRACE_EVENT(afs_flock_op,
1168 	    TP_PROTO(struct afs_vnode *vnode, struct file_lock *fl,
1169 		     enum afs_flock_operation op),
1170 
1171 	    TP_ARGS(vnode, fl, op),
1172 
1173 	    TP_STRUCT__entry(
1174 		    __field_struct(struct afs_fid,	fid		)
1175 		    __field(loff_t,			from		)
1176 		    __field(loff_t,			len		)
1177 		    __field(enum afs_flock_operation,	op		)
1178 		    __field(unsigned char,		type		)
1179 		    __field(unsigned int,		flags		)
1180 		    __field(unsigned int,		debug_id	)
1181 			     ),
1182 
1183 	    TP_fast_assign(
1184 		    __entry->fid = vnode->fid;
1185 		    __entry->from = fl->fl_start;
1186 		    __entry->len = fl->fl_end - fl->fl_start + 1;
1187 		    __entry->op = op;
1188 		    __entry->type = fl->fl_type;
1189 		    __entry->flags = fl->fl_flags;
1190 		    __entry->debug_id = fl->fl_u.afs.debug_id;
1191 			   ),
1192 
1193 	    TP_printk("%llx:%llx:%x %04x %s t=%s R=%llx/%llx f=%x",
1194 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
1195 		      __entry->debug_id,
1196 		      __print_symbolic(__entry->op, afs_flock_operations),
1197 		      __print_symbolic(__entry->type, afs_flock_types),
1198 		      __entry->from, __entry->len, __entry->flags)
1199 	    );
1200 
1201 TRACE_EVENT(afs_reload_dir,
1202 	    TP_PROTO(struct afs_vnode *vnode),
1203 
1204 	    TP_ARGS(vnode),
1205 
1206 	    TP_STRUCT__entry(
1207 		    __field_struct(struct afs_fid,	fid		)
1208 			     ),
1209 
1210 	    TP_fast_assign(
1211 		    __entry->fid = vnode->fid;
1212 			   ),
1213 
1214 	    TP_printk("%llx:%llx:%x",
1215 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique)
1216 	    );
1217 
1218 TRACE_EVENT(afs_silly_rename,
1219 	    TP_PROTO(struct afs_vnode *vnode, bool done),
1220 
1221 	    TP_ARGS(vnode, done),
1222 
1223 	    TP_STRUCT__entry(
1224 		    __field_struct(struct afs_fid,	fid		)
1225 		    __field(bool,			done		)
1226 			     ),
1227 
1228 	    TP_fast_assign(
1229 		    __entry->fid = vnode->fid;
1230 		    __entry->done = done;
1231 			   ),
1232 
1233 	    TP_printk("%llx:%llx:%x done=%u",
1234 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
1235 		      __entry->done)
1236 	    );
1237 
1238 TRACE_EVENT(afs_get_tree,
1239 	    TP_PROTO(struct afs_cell *cell, struct afs_volume *volume),
1240 
1241 	    TP_ARGS(cell, volume),
1242 
1243 	    TP_STRUCT__entry(
1244 		    __field(u64,			vid		)
1245 		    __array(char,			cell, 24	)
1246 		    __array(char,			volume, 24	)
1247 			     ),
1248 
1249 	    TP_fast_assign(
1250 		    int __len;
1251 		    __entry->vid = volume->vid;
1252 		    __len = min_t(int, cell->name_len, 23);
1253 		    memcpy(__entry->cell, cell->name, __len);
1254 		    __entry->cell[__len] = 0;
1255 		    __len = min_t(int, volume->name_len, 23);
1256 		    memcpy(__entry->volume, volume->name, __len);
1257 		    __entry->volume[__len] = 0;
1258 			   ),
1259 
1260 	    TP_printk("--- MOUNT %s:%s %llx",
1261 		      __entry->cell, __entry->volume, __entry->vid)
1262 	    );
1263 
1264 TRACE_EVENT(afs_cb_break,
1265 	    TP_PROTO(struct afs_fid *fid, unsigned int cb_break,
1266 		     enum afs_cb_break_reason reason, bool skipped),
1267 
1268 	    TP_ARGS(fid, cb_break, reason, skipped),
1269 
1270 	    TP_STRUCT__entry(
1271 		    __field_struct(struct afs_fid,	fid		)
1272 		    __field(unsigned int,		cb_break	)
1273 		    __field(enum afs_cb_break_reason,	reason		)
1274 		    __field(bool,			skipped		)
1275 			     ),
1276 
1277 	    TP_fast_assign(
1278 		    __entry->fid	= *fid;
1279 		    __entry->cb_break	= cb_break;
1280 		    __entry->reason	= reason;
1281 		    __entry->skipped	= skipped;
1282 			   ),
1283 
1284 	    TP_printk("%llx:%llx:%x b=%x s=%u %s",
1285 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
1286 		      __entry->cb_break,
1287 		      __entry->skipped,
1288 		      __print_symbolic(__entry->reason, afs_cb_break_reasons))
1289 	    );
1290 
1291 TRACE_EVENT(afs_cb_miss,
1292 	    TP_PROTO(struct afs_fid *fid, enum afs_cb_break_reason reason),
1293 
1294 	    TP_ARGS(fid, reason),
1295 
1296 	    TP_STRUCT__entry(
1297 		    __field_struct(struct afs_fid,	fid		)
1298 		    __field(enum afs_cb_break_reason,	reason		)
1299 			     ),
1300 
1301 	    TP_fast_assign(
1302 		    __entry->fid	= *fid;
1303 		    __entry->reason	= reason;
1304 			   ),
1305 
1306 	    TP_printk(" %llx:%llx:%x %s",
1307 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
1308 		      __print_symbolic(__entry->reason, afs_cb_break_reasons))
1309 	    );
1310 
1311 TRACE_EVENT(afs_server,
1312 	    TP_PROTO(struct afs_server *server, int ref, int active,
1313 		     enum afs_server_trace reason),
1314 
1315 	    TP_ARGS(server, ref, active, reason),
1316 
1317 	    TP_STRUCT__entry(
1318 		    __field(unsigned int,		server		)
1319 		    __field(int,			ref		)
1320 		    __field(int,			active		)
1321 		    __field(int,			reason		)
1322 			     ),
1323 
1324 	    TP_fast_assign(
1325 		    __entry->server = server->debug_id;
1326 		    __entry->ref = ref;
1327 		    __entry->active = active;
1328 		    __entry->reason = reason;
1329 			   ),
1330 
1331 	    TP_printk("s=%08x %s u=%d a=%d",
1332 		      __entry->server,
1333 		      __print_symbolic(__entry->reason, afs_server_traces),
1334 		      __entry->ref,
1335 		      __entry->active)
1336 	    );
1337 
1338 TRACE_EVENT(afs_volume,
1339 	    TP_PROTO(afs_volid_t vid, int ref, enum afs_volume_trace reason),
1340 
1341 	    TP_ARGS(vid, ref, reason),
1342 
1343 	    TP_STRUCT__entry(
1344 		    __field(afs_volid_t,		vid		)
1345 		    __field(int,			ref		)
1346 		    __field(enum afs_volume_trace,	reason		)
1347 			     ),
1348 
1349 	    TP_fast_assign(
1350 		    __entry->vid = vid;
1351 		    __entry->ref = ref;
1352 		    __entry->reason = reason;
1353 			   ),
1354 
1355 	    TP_printk("V=%llx %s u=%d",
1356 		      __entry->vid,
1357 		      __print_symbolic(__entry->reason, afs_volume_traces),
1358 		      __entry->ref)
1359 	    );
1360 
1361 #endif /* _TRACE_AFS_H */
1362 
1363 /* This part must be outside protection */
1364 #include <trace/define_trace.h>
1365