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