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