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