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