afs.h 23 KB

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