xref: /openbmc/linux/include/trace/events/afs.h (revision 023e4163)
1 /* AFS tracepoints
2  *
3  * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public Licence
8  * as published by the Free Software Foundation; either version
9  * 2 of the Licence, or (at your option) any later version.
10  */
11 #undef TRACE_SYSTEM
12 #define TRACE_SYSTEM afs
13 
14 #if !defined(_TRACE_AFS_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define _TRACE_AFS_H
16 
17 #include <linux/tracepoint.h>
18 
19 /*
20  * Define enums for tracing information.
21  */
22 #ifndef __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
23 #define __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
24 
25 enum afs_call_trace {
26 	afs_call_trace_alloc,
27 	afs_call_trace_free,
28 	afs_call_trace_get,
29 	afs_call_trace_put,
30 	afs_call_trace_wake,
31 	afs_call_trace_work,
32 };
33 
34 enum afs_fs_operation {
35 	afs_FS_FetchData		= 130,	/* AFS Fetch file data */
36 	afs_FS_FetchStatus		= 132,	/* AFS Fetch file status */
37 	afs_FS_StoreData		= 133,	/* AFS Store file data */
38 	afs_FS_StoreStatus		= 135,	/* AFS Store file status */
39 	afs_FS_RemoveFile		= 136,	/* AFS Remove a file */
40 	afs_FS_CreateFile		= 137,	/* AFS Create a file */
41 	afs_FS_Rename			= 138,	/* AFS Rename or move a file or directory */
42 	afs_FS_Symlink			= 139,	/* AFS Create a symbolic link */
43 	afs_FS_Link			= 140,	/* AFS Create a hard link */
44 	afs_FS_MakeDir			= 141,	/* AFS Create a directory */
45 	afs_FS_RemoveDir		= 142,	/* AFS Remove a directory */
46 	afs_FS_GetVolumeInfo		= 148,	/* AFS Get information about a volume */
47 	afs_FS_GetVolumeStatus		= 149,	/* AFS Get volume status information */
48 	afs_FS_GetRootVolume		= 151,	/* AFS Get root volume name */
49 	afs_FS_SetLock			= 156,	/* AFS Request a file lock */
50 	afs_FS_ExtendLock		= 157,	/* AFS Extend a file lock */
51 	afs_FS_ReleaseLock		= 158,	/* AFS Release a file lock */
52 	afs_FS_Lookup			= 161,	/* AFS lookup file in directory */
53 	afs_FS_InlineBulkStatus		= 65536, /* AFS Fetch multiple file statuses with errors */
54 	afs_FS_FetchData64		= 65537, /* AFS Fetch file data */
55 	afs_FS_StoreData64		= 65538, /* AFS Store file data */
56 	afs_FS_GiveUpAllCallBacks	= 65539, /* AFS Give up all our callbacks on a server */
57 	afs_FS_GetCapabilities		= 65540, /* AFS Get FS server capabilities */
58 
59 	yfs_FS_FetchData		= 130,	 /* YFS Fetch file data */
60 	yfs_FS_FetchACL			= 64131, /* YFS Fetch file ACL */
61 	yfs_FS_FetchStatus		= 64132, /* YFS Fetch file status */
62 	yfs_FS_StoreACL			= 64134, /* YFS Store file ACL */
63 	yfs_FS_StoreStatus		= 64135, /* YFS Store file status */
64 	yfs_FS_RemoveFile		= 64136, /* YFS Remove a file */
65 	yfs_FS_CreateFile		= 64137, /* YFS Create a file */
66 	yfs_FS_Rename			= 64138, /* YFS Rename or move a file or directory */
67 	yfs_FS_Symlink			= 64139, /* YFS Create a symbolic link */
68 	yfs_FS_Link			= 64140, /* YFS Create a hard link */
69 	yfs_FS_MakeDir			= 64141, /* YFS Create a directory */
70 	yfs_FS_RemoveDir		= 64142, /* YFS Remove a directory */
71 	yfs_FS_GetVolumeStatus		= 64149, /* YFS Get volume status information */
72 	yfs_FS_SetVolumeStatus		= 64150, /* YFS Set volume status information */
73 	yfs_FS_SetLock			= 64156, /* YFS Request a file lock */
74 	yfs_FS_ExtendLock		= 64157, /* YFS Extend a file lock */
75 	yfs_FS_ReleaseLock		= 64158, /* YFS Release a file lock */
76 	yfs_FS_Lookup			= 64161, /* YFS lookup file in directory */
77 	yfs_FS_FlushCPS			= 64165,
78 	yfs_FS_FetchOpaqueACL		= 64168,
79 	yfs_FS_WhoAmI			= 64170,
80 	yfs_FS_RemoveACL		= 64171,
81 	yfs_FS_RemoveFile2		= 64173,
82 	yfs_FS_StoreOpaqueACL2		= 64174,
83 	yfs_FS_InlineBulkStatus		= 64536, /* YFS Fetch multiple file statuses with errors */
84 	yfs_FS_FetchData64		= 64537, /* YFS Fetch file data */
85 	yfs_FS_StoreData64		= 64538, /* YFS Store file data */
86 	yfs_FS_UpdateSymlink		= 64540,
87 };
88 
89 enum afs_vl_operation {
90 	afs_VL_GetEntryByNameU	= 527,		/* AFS Get Vol Entry By Name operation ID */
91 	afs_VL_GetAddrsU	= 533,		/* AFS Get FS server addresses */
92 	afs_YFSVL_GetEndpoints	= 64002,	/* YFS Get FS & Vol server addresses */
93 	afs_VL_GetCapabilities	= 65537,	/* AFS Get VL server capabilities */
94 };
95 
96 enum afs_edit_dir_op {
97 	afs_edit_dir_create,
98 	afs_edit_dir_create_error,
99 	afs_edit_dir_create_inval,
100 	afs_edit_dir_create_nospc,
101 	afs_edit_dir_delete,
102 	afs_edit_dir_delete_error,
103 	afs_edit_dir_delete_inval,
104 	afs_edit_dir_delete_noent,
105 };
106 
107 enum afs_edit_dir_reason {
108 	afs_edit_dir_for_create,
109 	afs_edit_dir_for_link,
110 	afs_edit_dir_for_mkdir,
111 	afs_edit_dir_for_rename,
112 	afs_edit_dir_for_rmdir,
113 	afs_edit_dir_for_symlink,
114 	afs_edit_dir_for_unlink,
115 };
116 
117 enum afs_eproto_cause {
118 	afs_eproto_bad_status,
119 	afs_eproto_cb_count,
120 	afs_eproto_cb_fid_count,
121 	afs_eproto_file_type,
122 	afs_eproto_ibulkst_cb_count,
123 	afs_eproto_ibulkst_count,
124 	afs_eproto_motd_len,
125 	afs_eproto_offline_msg_len,
126 	afs_eproto_volname_len,
127 	afs_eproto_yvl_fsendpt4_len,
128 	afs_eproto_yvl_fsendpt6_len,
129 	afs_eproto_yvl_fsendpt_num,
130 	afs_eproto_yvl_fsendpt_type,
131 	afs_eproto_yvl_vlendpt4_len,
132 	afs_eproto_yvl_vlendpt6_len,
133 	afs_eproto_yvl_vlendpt_type,
134 };
135 
136 enum afs_io_error {
137 	afs_io_error_cm_reply,
138 	afs_io_error_extract,
139 	afs_io_error_fs_probe_fail,
140 	afs_io_error_vl_lookup_fail,
141 	afs_io_error_vl_probe_fail,
142 };
143 
144 enum afs_file_error {
145 	afs_file_error_dir_bad_magic,
146 	afs_file_error_dir_big,
147 	afs_file_error_dir_missing_page,
148 	afs_file_error_dir_over_end,
149 	afs_file_error_dir_small,
150 	afs_file_error_dir_unmarked_ext,
151 	afs_file_error_mntpt,
152 	afs_file_error_writeback_fail,
153 };
154 
155 #endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
156 
157 /*
158  * Declare tracing information enums and their string mappings for display.
159  */
160 #define afs_call_traces \
161 	EM(afs_call_trace_alloc,		"ALLOC") \
162 	EM(afs_call_trace_free,			"FREE ") \
163 	EM(afs_call_trace_get,			"GET  ") \
164 	EM(afs_call_trace_put,			"PUT  ") \
165 	EM(afs_call_trace_wake,			"WAKE ") \
166 	E_(afs_call_trace_work,			"WORK ")
167 
168 #define afs_fs_operations \
169 	EM(afs_FS_FetchData,			"FS.FetchData") \
170 	EM(afs_FS_FetchStatus,			"FS.FetchStatus") \
171 	EM(afs_FS_StoreData,			"FS.StoreData") \
172 	EM(afs_FS_StoreStatus,			"FS.StoreStatus") \
173 	EM(afs_FS_RemoveFile,			"FS.RemoveFile") \
174 	EM(afs_FS_CreateFile,			"FS.CreateFile") \
175 	EM(afs_FS_Rename,			"FS.Rename") \
176 	EM(afs_FS_Symlink,			"FS.Symlink") \
177 	EM(afs_FS_Link,				"FS.Link") \
178 	EM(afs_FS_MakeDir,			"FS.MakeDir") \
179 	EM(afs_FS_RemoveDir,			"FS.RemoveDir") \
180 	EM(afs_FS_GetVolumeInfo,		"FS.GetVolumeInfo") \
181 	EM(afs_FS_GetVolumeStatus,		"FS.GetVolumeStatus") \
182 	EM(afs_FS_GetRootVolume,		"FS.GetRootVolume") \
183 	EM(afs_FS_SetLock,			"FS.SetLock") \
184 	EM(afs_FS_ExtendLock,			"FS.ExtendLock") \
185 	EM(afs_FS_ReleaseLock,			"FS.ReleaseLock") \
186 	EM(afs_FS_Lookup,			"FS.Lookup") \
187 	EM(afs_FS_InlineBulkStatus,		"FS.InlineBulkStatus") \
188 	EM(afs_FS_FetchData64,			"FS.FetchData64") \
189 	EM(afs_FS_StoreData64,			"FS.StoreData64") \
190 	EM(afs_FS_GiveUpAllCallBacks,		"FS.GiveUpAllCallBacks") \
191 	EM(afs_FS_GetCapabilities,		"FS.GetCapabilities") \
192 	EM(yfs_FS_FetchACL,			"YFS.FetchACL") \
193 	EM(yfs_FS_FetchStatus,			"YFS.FetchStatus") \
194 	EM(yfs_FS_StoreACL,			"YFS.StoreACL") \
195 	EM(yfs_FS_StoreStatus,			"YFS.StoreStatus") \
196 	EM(yfs_FS_RemoveFile,			"YFS.RemoveFile") \
197 	EM(yfs_FS_CreateFile,			"YFS.CreateFile") \
198 	EM(yfs_FS_Rename,			"YFS.Rename") \
199 	EM(yfs_FS_Symlink,			"YFS.Symlink") \
200 	EM(yfs_FS_Link,				"YFS.Link") \
201 	EM(yfs_FS_MakeDir,			"YFS.MakeDir") \
202 	EM(yfs_FS_RemoveDir,			"YFS.RemoveDir") \
203 	EM(yfs_FS_GetVolumeStatus,		"YFS.GetVolumeStatus") \
204 	EM(yfs_FS_SetVolumeStatus,		"YFS.SetVolumeStatus") \
205 	EM(yfs_FS_SetLock,			"YFS.SetLock") \
206 	EM(yfs_FS_ExtendLock,			"YFS.ExtendLock") \
207 	EM(yfs_FS_ReleaseLock,			"YFS.ReleaseLock") \
208 	EM(yfs_FS_Lookup,			"YFS.Lookup") \
209 	EM(yfs_FS_FlushCPS,			"YFS.FlushCPS") \
210 	EM(yfs_FS_FetchOpaqueACL,		"YFS.FetchOpaqueACL") \
211 	EM(yfs_FS_WhoAmI,			"YFS.WhoAmI") \
212 	EM(yfs_FS_RemoveACL,			"YFS.RemoveACL") \
213 	EM(yfs_FS_RemoveFile2,			"YFS.RemoveFile2") \
214 	EM(yfs_FS_StoreOpaqueACL2,		"YFS.StoreOpaqueACL2") \
215 	EM(yfs_FS_InlineBulkStatus,		"YFS.InlineBulkStatus") \
216 	EM(yfs_FS_FetchData64,			"YFS.FetchData64") \
217 	EM(yfs_FS_StoreData64,			"YFS.StoreData64") \
218 	E_(yfs_FS_UpdateSymlink,		"YFS.UpdateSymlink")
219 
220 #define afs_vl_operations \
221 	EM(afs_VL_GetEntryByNameU,		"VL.GetEntryByNameU") \
222 	EM(afs_VL_GetAddrsU,			"VL.GetAddrsU") \
223 	EM(afs_YFSVL_GetEndpoints,		"YFSVL.GetEndpoints") \
224 	E_(afs_VL_GetCapabilities,		"VL.GetCapabilities")
225 
226 #define afs_edit_dir_ops				  \
227 	EM(afs_edit_dir_create,			"create") \
228 	EM(afs_edit_dir_create_error,		"c_fail") \
229 	EM(afs_edit_dir_create_inval,		"c_invl") \
230 	EM(afs_edit_dir_create_nospc,		"c_nspc") \
231 	EM(afs_edit_dir_delete,			"delete") \
232 	EM(afs_edit_dir_delete_error,		"d_err ") \
233 	EM(afs_edit_dir_delete_inval,		"d_invl") \
234 	E_(afs_edit_dir_delete_noent,		"d_nent")
235 
236 #define afs_edit_dir_reasons				  \
237 	EM(afs_edit_dir_for_create,		"Create") \
238 	EM(afs_edit_dir_for_link,		"Link  ") \
239 	EM(afs_edit_dir_for_mkdir,		"MkDir ") \
240 	EM(afs_edit_dir_for_rename,		"Rename") \
241 	EM(afs_edit_dir_for_rmdir,		"RmDir ") \
242 	EM(afs_edit_dir_for_symlink,		"Symlnk") \
243 	E_(afs_edit_dir_for_unlink,		"Unlink")
244 
245 #define afs_eproto_causes			\
246 	EM(afs_eproto_bad_status,	"BadStatus") \
247 	EM(afs_eproto_cb_count,		"CbCount") \
248 	EM(afs_eproto_cb_fid_count,	"CbFidCount") \
249 	EM(afs_eproto_file_type,	"FileTYpe") \
250 	EM(afs_eproto_ibulkst_cb_count,	"IBS.CbCount") \
251 	EM(afs_eproto_ibulkst_count,	"IBS.FidCount") \
252 	EM(afs_eproto_motd_len,		"MotdLen") \
253 	EM(afs_eproto_offline_msg_len,	"OfflineMsgLen") \
254 	EM(afs_eproto_volname_len,	"VolNameLen") \
255 	EM(afs_eproto_yvl_fsendpt4_len,	"YVL.FsEnd4Len") \
256 	EM(afs_eproto_yvl_fsendpt6_len,	"YVL.FsEnd6Len") \
257 	EM(afs_eproto_yvl_fsendpt_num,	"YVL.FsEndCount") \
258 	EM(afs_eproto_yvl_fsendpt_type,	"YVL.FsEndType") \
259 	EM(afs_eproto_yvl_vlendpt4_len,	"YVL.VlEnd4Len") \
260 	EM(afs_eproto_yvl_vlendpt6_len,	"YVL.VlEnd6Len") \
261 	E_(afs_eproto_yvl_vlendpt_type,	"YVL.VlEndType")
262 
263 #define afs_io_errors							\
264 	EM(afs_io_error_cm_reply,		"CM_REPLY")		\
265 	EM(afs_io_error_extract,		"EXTRACT")		\
266 	EM(afs_io_error_fs_probe_fail,		"FS_PROBE_FAIL")	\
267 	EM(afs_io_error_vl_lookup_fail,		"VL_LOOKUP_FAIL")	\
268 	E_(afs_io_error_vl_probe_fail,		"VL_PROBE_FAIL")
269 
270 #define afs_file_errors							\
271 	EM(afs_file_error_dir_bad_magic,	"DIR_BAD_MAGIC")	\
272 	EM(afs_file_error_dir_big,		"DIR_BIG")		\
273 	EM(afs_file_error_dir_missing_page,	"DIR_MISSING_PAGE")	\
274 	EM(afs_file_error_dir_over_end,		"DIR_ENT_OVER_END")	\
275 	EM(afs_file_error_dir_small,		"DIR_SMALL")		\
276 	EM(afs_file_error_dir_unmarked_ext,	"DIR_UNMARKED_EXT")	\
277 	EM(afs_file_error_mntpt,		"MNTPT_READ_FAILED")	\
278 	E_(afs_file_error_writeback_fail,	"WRITEBACK_FAILED")
279 
280 /*
281  * Export enum symbols via userspace.
282  */
283 #undef EM
284 #undef E_
285 #define EM(a, b) TRACE_DEFINE_ENUM(a);
286 #define E_(a, b) TRACE_DEFINE_ENUM(a);
287 
288 afs_call_traces;
289 afs_fs_operations;
290 afs_vl_operations;
291 afs_edit_dir_ops;
292 afs_edit_dir_reasons;
293 afs_eproto_causes;
294 afs_io_errors;
295 afs_file_errors;
296 
297 /*
298  * Now redefine the EM() and E_() macros to map the enums to the strings that
299  * will be printed in the output.
300  */
301 #undef EM
302 #undef E_
303 #define EM(a, b)	{ a, b },
304 #define E_(a, b)	{ a, b }
305 
306 TRACE_EVENT(afs_receive_data,
307 	    TP_PROTO(struct afs_call *call, struct iov_iter *iter,
308 		     bool want_more, int ret),
309 
310 	    TP_ARGS(call, iter, want_more, ret),
311 
312 	    TP_STRUCT__entry(
313 		    __field(loff_t,			remain		)
314 		    __field(unsigned int,		call		)
315 		    __field(enum afs_call_state,	state		)
316 		    __field(unsigned short,		unmarshall	)
317 		    __field(bool,			want_more	)
318 		    __field(int,			ret		)
319 			     ),
320 
321 	    TP_fast_assign(
322 		    __entry->call	= call->debug_id;
323 		    __entry->state	= call->state;
324 		    __entry->unmarshall	= call->unmarshall;
325 		    __entry->remain	= iov_iter_count(iter);
326 		    __entry->want_more	= want_more;
327 		    __entry->ret	= ret;
328 			   ),
329 
330 	    TP_printk("c=%08x r=%llu u=%u w=%u s=%u ret=%d",
331 		      __entry->call,
332 		      __entry->remain,
333 		      __entry->unmarshall,
334 		      __entry->want_more,
335 		      __entry->state,
336 		      __entry->ret)
337 	    );
338 
339 TRACE_EVENT(afs_notify_call,
340 	    TP_PROTO(struct rxrpc_call *rxcall, struct afs_call *call),
341 
342 	    TP_ARGS(rxcall, call),
343 
344 	    TP_STRUCT__entry(
345 		    __field(unsigned int,		call		)
346 		    __field(enum afs_call_state,	state		)
347 		    __field(unsigned short,		unmarshall	)
348 			     ),
349 
350 	    TP_fast_assign(
351 		    __entry->call	= call->debug_id;
352 		    __entry->state	= call->state;
353 		    __entry->unmarshall	= call->unmarshall;
354 			   ),
355 
356 	    TP_printk("c=%08x s=%u u=%u",
357 		      __entry->call,
358 		      __entry->state, __entry->unmarshall)
359 	    );
360 
361 TRACE_EVENT(afs_cb_call,
362 	    TP_PROTO(struct afs_call *call),
363 
364 	    TP_ARGS(call),
365 
366 	    TP_STRUCT__entry(
367 		    __field(unsigned int,		call		)
368 		    __field(const char *,		name		)
369 		    __field(u32,			op		)
370 			     ),
371 
372 	    TP_fast_assign(
373 		    __entry->call	= call->debug_id;
374 		    __entry->name	= call->type->name;
375 		    __entry->op		= call->operation_ID;
376 			   ),
377 
378 	    TP_printk("c=%08x %s o=%u",
379 		      __entry->call,
380 		      __entry->name,
381 		      __entry->op)
382 	    );
383 
384 TRACE_EVENT(afs_call,
385 	    TP_PROTO(struct afs_call *call, enum afs_call_trace op,
386 		     int usage, int outstanding, const void *where),
387 
388 	    TP_ARGS(call, op, usage, outstanding, where),
389 
390 	    TP_STRUCT__entry(
391 		    __field(unsigned int,		call		)
392 		    __field(int,			op		)
393 		    __field(int,			usage		)
394 		    __field(int,			outstanding	)
395 		    __field(const void *,		where		)
396 			     ),
397 
398 	    TP_fast_assign(
399 		    __entry->call = call->debug_id;
400 		    __entry->op = op;
401 		    __entry->usage = usage;
402 		    __entry->outstanding = outstanding;
403 		    __entry->where = where;
404 			   ),
405 
406 	    TP_printk("c=%08x %s u=%d o=%d sp=%pSR",
407 		      __entry->call,
408 		      __print_symbolic(__entry->op, afs_call_traces),
409 		      __entry->usage,
410 		      __entry->outstanding,
411 		      __entry->where)
412 	    );
413 
414 TRACE_EVENT(afs_make_fs_call,
415 	    TP_PROTO(struct afs_call *call, const struct afs_fid *fid),
416 
417 	    TP_ARGS(call, fid),
418 
419 	    TP_STRUCT__entry(
420 		    __field(unsigned int,		call		)
421 		    __field(enum afs_fs_operation,	op		)
422 		    __field_struct(struct afs_fid,	fid		)
423 			     ),
424 
425 	    TP_fast_assign(
426 		    __entry->call = call->debug_id;
427 		    __entry->op = call->operation_ID;
428 		    if (fid) {
429 			    __entry->fid = *fid;
430 		    } else {
431 			    __entry->fid.vid = 0;
432 			    __entry->fid.vnode = 0;
433 			    __entry->fid.unique = 0;
434 		    }
435 			   ),
436 
437 	    TP_printk("c=%08x %06llx:%06llx:%06x %s",
438 		      __entry->call,
439 		      __entry->fid.vid,
440 		      __entry->fid.vnode,
441 		      __entry->fid.unique,
442 		      __print_symbolic(__entry->op, afs_fs_operations))
443 	    );
444 
445 TRACE_EVENT(afs_make_vl_call,
446 	    TP_PROTO(struct afs_call *call),
447 
448 	    TP_ARGS(call),
449 
450 	    TP_STRUCT__entry(
451 		    __field(unsigned int,		call		)
452 		    __field(enum afs_vl_operation,	op		)
453 			     ),
454 
455 	    TP_fast_assign(
456 		    __entry->call = call->debug_id;
457 		    __entry->op = call->operation_ID;
458 			   ),
459 
460 	    TP_printk("c=%08x %s",
461 		      __entry->call,
462 		      __print_symbolic(__entry->op, afs_vl_operations))
463 	    );
464 
465 TRACE_EVENT(afs_call_done,
466 	    TP_PROTO(struct afs_call *call),
467 
468 	    TP_ARGS(call),
469 
470 	    TP_STRUCT__entry(
471 		    __field(unsigned int,		call		)
472 		    __field(struct rxrpc_call *,	rx_call		)
473 		    __field(int,			ret		)
474 		    __field(u32,			abort_code	)
475 			     ),
476 
477 	    TP_fast_assign(
478 		    __entry->call = call->debug_id;
479 		    __entry->rx_call = call->rxcall;
480 		    __entry->ret = call->error;
481 		    __entry->abort_code = call->abort_code;
482 			   ),
483 
484 	    TP_printk("   c=%08x ret=%d ab=%d [%p]",
485 		      __entry->call,
486 		      __entry->ret,
487 		      __entry->abort_code,
488 		      __entry->rx_call)
489 	    );
490 
491 TRACE_EVENT(afs_send_pages,
492 	    TP_PROTO(struct afs_call *call, struct msghdr *msg,
493 		     pgoff_t first, pgoff_t last, unsigned int offset),
494 
495 	    TP_ARGS(call, msg, first, last, offset),
496 
497 	    TP_STRUCT__entry(
498 		    __field(unsigned int,		call		)
499 		    __field(pgoff_t,			first		)
500 		    __field(pgoff_t,			last		)
501 		    __field(unsigned int,		nr		)
502 		    __field(unsigned int,		bytes		)
503 		    __field(unsigned int,		offset		)
504 		    __field(unsigned int,		flags		)
505 			     ),
506 
507 	    TP_fast_assign(
508 		    __entry->call = call->debug_id;
509 		    __entry->first = first;
510 		    __entry->last = last;
511 		    __entry->nr = msg->msg_iter.nr_segs;
512 		    __entry->bytes = msg->msg_iter.count;
513 		    __entry->offset = offset;
514 		    __entry->flags = msg->msg_flags;
515 			   ),
516 
517 	    TP_printk(" c=%08x %lx-%lx-%lx b=%x o=%x f=%x",
518 		      __entry->call,
519 		      __entry->first, __entry->first + __entry->nr - 1, __entry->last,
520 		      __entry->bytes, __entry->offset,
521 		      __entry->flags)
522 	    );
523 
524 TRACE_EVENT(afs_sent_pages,
525 	    TP_PROTO(struct afs_call *call, pgoff_t first, pgoff_t last,
526 		     pgoff_t cursor, int ret),
527 
528 	    TP_ARGS(call, first, last, cursor, ret),
529 
530 	    TP_STRUCT__entry(
531 		    __field(unsigned int,		call		)
532 		    __field(pgoff_t,			first		)
533 		    __field(pgoff_t,			last		)
534 		    __field(pgoff_t,			cursor		)
535 		    __field(int,			ret		)
536 			     ),
537 
538 	    TP_fast_assign(
539 		    __entry->call = call->debug_id;
540 		    __entry->first = first;
541 		    __entry->last = last;
542 		    __entry->cursor = cursor;
543 		    __entry->ret = ret;
544 			   ),
545 
546 	    TP_printk(" c=%08x %lx-%lx c=%lx r=%d",
547 		      __entry->call,
548 		      __entry->first, __entry->last,
549 		      __entry->cursor, __entry->ret)
550 	    );
551 
552 TRACE_EVENT(afs_dir_check_failed,
553 	    TP_PROTO(struct afs_vnode *vnode, loff_t off, loff_t i_size),
554 
555 	    TP_ARGS(vnode, off, i_size),
556 
557 	    TP_STRUCT__entry(
558 		    __field(struct afs_vnode *,		vnode		)
559 		    __field(loff_t,			off		)
560 		    __field(loff_t,			i_size		)
561 			     ),
562 
563 	    TP_fast_assign(
564 		    __entry->vnode = vnode;
565 		    __entry->off = off;
566 		    __entry->i_size = i_size;
567 			   ),
568 
569 	    TP_printk("vn=%p %llx/%llx",
570 		      __entry->vnode, __entry->off, __entry->i_size)
571 	    );
572 
573 /*
574  * We use page->private to hold the amount of the page that we've written to,
575  * splitting the field into two parts.  However, we need to represent a range
576  * 0...PAGE_SIZE inclusive, so we can't support 64K pages on a 32-bit system.
577  */
578 #if PAGE_SIZE > 32768
579 #define AFS_PRIV_MAX	0xffffffff
580 #define AFS_PRIV_SHIFT	32
581 #else
582 #define AFS_PRIV_MAX	0xffff
583 #define AFS_PRIV_SHIFT	16
584 #endif
585 
586 TRACE_EVENT(afs_page_dirty,
587 	    TP_PROTO(struct afs_vnode *vnode, const char *where,
588 		     pgoff_t page, unsigned long priv),
589 
590 	    TP_ARGS(vnode, where, page, priv),
591 
592 	    TP_STRUCT__entry(
593 		    __field(struct afs_vnode *,		vnode		)
594 		    __field(const char *,		where		)
595 		    __field(pgoff_t,			page		)
596 		    __field(unsigned long,		priv		)
597 			     ),
598 
599 	    TP_fast_assign(
600 		    __entry->vnode = vnode;
601 		    __entry->where = where;
602 		    __entry->page = page;
603 		    __entry->priv = priv;
604 			   ),
605 
606 	    TP_printk("vn=%p %lx %s %lu-%lu",
607 		      __entry->vnode, __entry->page, __entry->where,
608 		      __entry->priv & AFS_PRIV_MAX,
609 		      __entry->priv >> AFS_PRIV_SHIFT)
610 	    );
611 
612 TRACE_EVENT(afs_call_state,
613 	    TP_PROTO(struct afs_call *call,
614 		     enum afs_call_state from,
615 		     enum afs_call_state to,
616 		     int ret, u32 remote_abort),
617 
618 	    TP_ARGS(call, from, to, ret, remote_abort),
619 
620 	    TP_STRUCT__entry(
621 		    __field(unsigned int,		call		)
622 		    __field(enum afs_call_state,	from		)
623 		    __field(enum afs_call_state,	to		)
624 		    __field(int,			ret		)
625 		    __field(u32,			abort		)
626 			     ),
627 
628 	    TP_fast_assign(
629 		    __entry->call = call->debug_id;
630 		    __entry->from = from;
631 		    __entry->to = to;
632 		    __entry->ret = ret;
633 		    __entry->abort = remote_abort;
634 			   ),
635 
636 	    TP_printk("c=%08x %u->%u r=%d ab=%d",
637 		      __entry->call,
638 		      __entry->from, __entry->to,
639 		      __entry->ret, __entry->abort)
640 	    );
641 
642 TRACE_EVENT(afs_edit_dir,
643 	    TP_PROTO(struct afs_vnode *dvnode,
644 		     enum afs_edit_dir_reason why,
645 		     enum afs_edit_dir_op op,
646 		     unsigned int block,
647 		     unsigned int slot,
648 		     unsigned int f_vnode,
649 		     unsigned int f_unique,
650 		     const char *name),
651 
652 	    TP_ARGS(dvnode, why, op, block, slot, f_vnode, f_unique, name),
653 
654 	    TP_STRUCT__entry(
655 		    __field(unsigned int,		vnode		)
656 		    __field(unsigned int,		unique		)
657 		    __field(enum afs_edit_dir_reason,	why		)
658 		    __field(enum afs_edit_dir_op,	op		)
659 		    __field(unsigned int,		block		)
660 		    __field(unsigned short,		slot		)
661 		    __field(unsigned int,		f_vnode		)
662 		    __field(unsigned int,		f_unique	)
663 		    __array(char,			name, 18	)
664 			     ),
665 
666 	    TP_fast_assign(
667 		    int __len = strlen(name);
668 		    __len = min(__len, 17);
669 		    __entry->vnode	= dvnode->fid.vnode;
670 		    __entry->unique	= dvnode->fid.unique;
671 		    __entry->why	= why;
672 		    __entry->op		= op;
673 		    __entry->block	= block;
674 		    __entry->slot	= slot;
675 		    __entry->f_vnode	= f_vnode;
676 		    __entry->f_unique	= f_unique;
677 		    memcpy(__entry->name, name, __len);
678 		    __entry->name[__len] = 0;
679 			   ),
680 
681 	    TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x %s",
682 		      __entry->vnode, __entry->unique,
683 		      __print_symbolic(__entry->why, afs_edit_dir_reasons),
684 		      __print_symbolic(__entry->op, afs_edit_dir_ops),
685 		      __entry->block, __entry->slot,
686 		      __entry->f_vnode, __entry->f_unique,
687 		      __entry->name)
688 	    );
689 
690 TRACE_EVENT(afs_protocol_error,
691 	    TP_PROTO(struct afs_call *call, int error, enum afs_eproto_cause cause),
692 
693 	    TP_ARGS(call, error, cause),
694 
695 	    TP_STRUCT__entry(
696 		    __field(unsigned int,		call		)
697 		    __field(int,			error		)
698 		    __field(enum afs_eproto_cause,	cause		)
699 			     ),
700 
701 	    TP_fast_assign(
702 		    __entry->call = call ? call->debug_id : 0;
703 		    __entry->error = error;
704 		    __entry->cause = cause;
705 			   ),
706 
707 	    TP_printk("c=%08x r=%d %s",
708 		      __entry->call, __entry->error,
709 		      __print_symbolic(__entry->cause, afs_eproto_causes))
710 	    );
711 
712 TRACE_EVENT(afs_io_error,
713 	    TP_PROTO(unsigned int call, int error, enum afs_io_error where),
714 
715 	    TP_ARGS(call, error, where),
716 
717 	    TP_STRUCT__entry(
718 		    __field(unsigned int,	call		)
719 		    __field(int,		error		)
720 		    __field(enum afs_io_error,	where		)
721 			     ),
722 
723 	    TP_fast_assign(
724 		    __entry->call = call;
725 		    __entry->error = error;
726 		    __entry->where = where;
727 			   ),
728 
729 	    TP_printk("c=%08x r=%d %s",
730 		      __entry->call, __entry->error,
731 		      __print_symbolic(__entry->where, afs_io_errors))
732 	    );
733 
734 TRACE_EVENT(afs_file_error,
735 	    TP_PROTO(struct afs_vnode *vnode, int error, enum afs_file_error where),
736 
737 	    TP_ARGS(vnode, error, where),
738 
739 	    TP_STRUCT__entry(
740 		    __field_struct(struct afs_fid,	fid		)
741 		    __field(int,			error		)
742 		    __field(enum afs_file_error,	where		)
743 			     ),
744 
745 	    TP_fast_assign(
746 		    __entry->fid = vnode->fid;
747 		    __entry->error = error;
748 		    __entry->where = where;
749 			   ),
750 
751 	    TP_printk("%llx:%llx:%x r=%d %s",
752 		      __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
753 		      __entry->error,
754 		      __print_symbolic(__entry->where, afs_file_errors))
755 	    );
756 
757 TRACE_EVENT(afs_cm_no_server,
758 	    TP_PROTO(struct afs_call *call, struct sockaddr_rxrpc *srx),
759 
760 	    TP_ARGS(call, srx),
761 
762 	    TP_STRUCT__entry(
763 		    __field(unsigned int,			call	)
764 		    __field(unsigned int,			op_id	)
765 		    __field_struct(struct sockaddr_rxrpc,	srx	)
766 			     ),
767 
768 	    TP_fast_assign(
769 		    __entry->call = call->debug_id;
770 		    __entry->op_id = call->operation_ID;
771 		    memcpy(&__entry->srx, srx, sizeof(__entry->srx));
772 			   ),
773 
774 	    TP_printk("c=%08x op=%u %pISpc",
775 		      __entry->call, __entry->op_id, &__entry->srx.transport)
776 	    );
777 
778 TRACE_EVENT(afs_cm_no_server_u,
779 	    TP_PROTO(struct afs_call *call, const uuid_t *uuid),
780 
781 	    TP_ARGS(call, uuid),
782 
783 	    TP_STRUCT__entry(
784 		    __field(unsigned int,			call	)
785 		    __field(unsigned int,			op_id	)
786 		    __field_struct(uuid_t,			uuid	)
787 			     ),
788 
789 	    TP_fast_assign(
790 		    __entry->call = call->debug_id;
791 		    __entry->op_id = call->operation_ID;
792 		    memcpy(&__entry->uuid, uuid, sizeof(__entry->uuid));
793 			   ),
794 
795 	    TP_printk("c=%08x op=%u %pU",
796 		      __entry->call, __entry->op_id, &__entry->uuid)
797 	    );
798 
799 #endif /* _TRACE_AFS_H */
800 
801 /* This part must be outside protection */
802 #include <trace/define_trace.h>
803