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