nfs4trace.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209
  1. /*
  2. * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
  3. */
  4. #undef TRACE_SYSTEM
  5. #define TRACE_SYSTEM nfs4
  6. #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
  7. #define _TRACE_NFS4_H
  8. #include <linux/tracepoint.h>
  9. #define show_nfsv4_errors(error) \
  10. __print_symbolic(error, \
  11. { NFS4_OK, "OK" }, \
  12. /* Mapped by nfs4_stat_to_errno() */ \
  13. { -EPERM, "EPERM" }, \
  14. { -ENOENT, "ENOENT" }, \
  15. { -EIO, "EIO" }, \
  16. { -ENXIO, "ENXIO" }, \
  17. { -EACCES, "EACCES" }, \
  18. { -EEXIST, "EEXIST" }, \
  19. { -EXDEV, "EXDEV" }, \
  20. { -ENOTDIR, "ENOTDIR" }, \
  21. { -EISDIR, "EISDIR" }, \
  22. { -EFBIG, "EFBIG" }, \
  23. { -ENOSPC, "ENOSPC" }, \
  24. { -EROFS, "EROFS" }, \
  25. { -EMLINK, "EMLINK" }, \
  26. { -ENAMETOOLONG, "ENAMETOOLONG" }, \
  27. { -ENOTEMPTY, "ENOTEMPTY" }, \
  28. { -EDQUOT, "EDQUOT" }, \
  29. { -ESTALE, "ESTALE" }, \
  30. { -EBADHANDLE, "EBADHANDLE" }, \
  31. { -EBADCOOKIE, "EBADCOOKIE" }, \
  32. { -ENOTSUPP, "ENOTSUPP" }, \
  33. { -ETOOSMALL, "ETOOSMALL" }, \
  34. { -EREMOTEIO, "EREMOTEIO" }, \
  35. { -EBADTYPE, "EBADTYPE" }, \
  36. { -EAGAIN, "EAGAIN" }, \
  37. { -ELOOP, "ELOOP" }, \
  38. { -EOPNOTSUPP, "EOPNOTSUPP" }, \
  39. { -EDEADLK, "EDEADLK" }, \
  40. /* RPC errors */ \
  41. { -ENOMEM, "ENOMEM" }, \
  42. { -EKEYEXPIRED, "EKEYEXPIRED" }, \
  43. { -ETIMEDOUT, "ETIMEDOUT" }, \
  44. { -ERESTARTSYS, "ERESTARTSYS" }, \
  45. { -ECONNREFUSED, "ECONNREFUSED" }, \
  46. { -ECONNRESET, "ECONNRESET" }, \
  47. { -ENETUNREACH, "ENETUNREACH" }, \
  48. { -EHOSTUNREACH, "EHOSTUNREACH" }, \
  49. { -EHOSTDOWN, "EHOSTDOWN" }, \
  50. { -EPIPE, "EPIPE" }, \
  51. { -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
  52. { -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
  53. /* NFSv4 native errors */ \
  54. { -NFS4ERR_ACCESS, "ACCESS" }, \
  55. { -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
  56. { -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
  57. { -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
  58. { -NFS4ERR_BADCHAR, "BADCHAR" }, \
  59. { -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
  60. { -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
  61. { -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
  62. { -NFS4ERR_BADLABEL, "BADLABEL" }, \
  63. { -NFS4ERR_BADNAME, "BADNAME" }, \
  64. { -NFS4ERR_BADOWNER, "BADOWNER" }, \
  65. { -NFS4ERR_BADSESSION, "BADSESSION" }, \
  66. { -NFS4ERR_BADSLOT, "BADSLOT" }, \
  67. { -NFS4ERR_BADTYPE, "BADTYPE" }, \
  68. { -NFS4ERR_BADXDR, "BADXDR" }, \
  69. { -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
  70. { -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
  71. { -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
  72. { -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
  73. { -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
  74. { -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
  75. { -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
  76. { -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
  77. { -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
  78. { -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
  79. { -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
  80. "CONN_NOT_BOUND_TO_SESSION" }, \
  81. { -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
  82. { -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
  83. { -NFS4ERR_DELAY, "DELAY" }, \
  84. { -NFS4ERR_DELEG_ALREADY_WANTED, \
  85. "DELEG_ALREADY_WANTED" }, \
  86. { -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
  87. { -NFS4ERR_DENIED, "DENIED" }, \
  88. { -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
  89. { -NFS4ERR_DQUOT, "DQUOT" }, \
  90. { -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
  91. { -NFS4ERR_EXIST, "EXIST" }, \
  92. { -NFS4ERR_EXPIRED, "EXPIRED" }, \
  93. { -NFS4ERR_FBIG, "FBIG" }, \
  94. { -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
  95. { -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
  96. { -NFS4ERR_GRACE, "GRACE" }, \
  97. { -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
  98. { -NFS4ERR_INVAL, "INVAL" }, \
  99. { -NFS4ERR_IO, "IO" }, \
  100. { -NFS4ERR_ISDIR, "ISDIR" }, \
  101. { -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
  102. { -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
  103. { -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
  104. { -NFS4ERR_LOCKED, "LOCKED" }, \
  105. { -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
  106. { -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
  107. { -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
  108. { -NFS4ERR_MLINK, "MLINK" }, \
  109. { -NFS4ERR_MOVED, "MOVED" }, \
  110. { -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
  111. { -NFS4ERR_NOENT, "NOENT" }, \
  112. { -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
  113. { -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
  114. { -NFS4ERR_NOSPC, "NOSPC" }, \
  115. { -NFS4ERR_NOTDIR, "NOTDIR" }, \
  116. { -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
  117. { -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
  118. { -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
  119. { -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
  120. { -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
  121. { -NFS4ERR_NXIO, "NXIO" }, \
  122. { -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
  123. { -NFS4ERR_OPENMODE, "OPENMODE" }, \
  124. { -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
  125. { -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
  126. { -NFS4ERR_PERM, "PERM" }, \
  127. { -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
  128. { -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
  129. { -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
  130. { -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
  131. { -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
  132. { -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
  133. { -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
  134. { -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
  135. "REP_TOO_BIG_TO_CACHE" }, \
  136. { -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
  137. { -NFS4ERR_RESOURCE, "RESOURCE" }, \
  138. { -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
  139. { -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
  140. { -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
  141. { -NFS4ERR_ROFS, "ROFS" }, \
  142. { -NFS4ERR_SAME, "SAME" }, \
  143. { -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
  144. { -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
  145. { -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
  146. { -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
  147. { -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
  148. { -NFS4ERR_STALE, "STALE" }, \
  149. { -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
  150. { -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
  151. { -NFS4ERR_SYMLINK, "SYMLINK" }, \
  152. { -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
  153. { -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
  154. { -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
  155. { -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
  156. { -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
  157. { -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
  158. { -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
  159. { -NFS4ERR_XDEV, "XDEV" })
  160. #define show_open_flags(flags) \
  161. __print_flags(flags, "|", \
  162. { O_CREAT, "O_CREAT" }, \
  163. { O_EXCL, "O_EXCL" }, \
  164. { O_TRUNC, "O_TRUNC" }, \
  165. { O_DIRECT, "O_DIRECT" })
  166. #define show_fmode_flags(mode) \
  167. __print_flags(mode, "|", \
  168. { ((__force unsigned long)FMODE_READ), "READ" }, \
  169. { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
  170. { ((__force unsigned long)FMODE_EXEC), "EXEC" })
  171. #define show_nfs_fattr_flags(valid) \
  172. __print_flags((unsigned long)valid, "|", \
  173. { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
  174. { NFS_ATTR_FATTR_MODE, "MODE" }, \
  175. { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
  176. { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
  177. { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
  178. { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
  179. { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
  180. { NFS_ATTR_FATTR_FSID, "FSID" }, \
  181. { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
  182. { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
  183. { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
  184. { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
  185. { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
  186. { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
  187. { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
  188. DECLARE_EVENT_CLASS(nfs4_clientid_event,
  189. TP_PROTO(
  190. const struct nfs_client *clp,
  191. int error
  192. ),
  193. TP_ARGS(clp, error),
  194. TP_STRUCT__entry(
  195. __string(dstaddr,
  196. rpc_peeraddr2str(clp->cl_rpcclient,
  197. RPC_DISPLAY_ADDR))
  198. __field(int, error)
  199. ),
  200. TP_fast_assign(
  201. __entry->error = error;
  202. __assign_str(dstaddr,
  203. rpc_peeraddr2str(clp->cl_rpcclient,
  204. RPC_DISPLAY_ADDR));
  205. ),
  206. TP_printk(
  207. "error=%d (%s) dstaddr=%s",
  208. __entry->error,
  209. show_nfsv4_errors(__entry->error),
  210. __get_str(dstaddr)
  211. )
  212. );
  213. #define DEFINE_NFS4_CLIENTID_EVENT(name) \
  214. DEFINE_EVENT(nfs4_clientid_event, name, \
  215. TP_PROTO( \
  216. const struct nfs_client *clp, \
  217. int error \
  218. ), \
  219. TP_ARGS(clp, error))
  220. DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
  221. DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
  222. DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
  223. DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
  224. #ifdef CONFIG_NFS_V4_1
  225. DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
  226. DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
  227. DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
  228. DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
  229. DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
  230. DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
  231. DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
  232. TRACE_EVENT(nfs4_setup_sequence,
  233. TP_PROTO(
  234. const struct nfs4_session *session,
  235. const struct nfs4_sequence_args *args
  236. ),
  237. TP_ARGS(session, args),
  238. TP_STRUCT__entry(
  239. __field(unsigned int, session)
  240. __field(unsigned int, slot_nr)
  241. __field(unsigned int, seq_nr)
  242. __field(unsigned int, highest_used_slotid)
  243. ),
  244. TP_fast_assign(
  245. const struct nfs4_slot *sa_slot = args->sa_slot;
  246. __entry->session = nfs_session_id_hash(&session->sess_id);
  247. __entry->slot_nr = sa_slot->slot_nr;
  248. __entry->seq_nr = sa_slot->seq_nr;
  249. __entry->highest_used_slotid =
  250. sa_slot->table->highest_used_slotid;
  251. ),
  252. TP_printk(
  253. "session=0x%08x slot_nr=%u seq_nr=%u "
  254. "highest_used_slotid=%u",
  255. __entry->session,
  256. __entry->slot_nr,
  257. __entry->seq_nr,
  258. __entry->highest_used_slotid
  259. )
  260. );
  261. #define show_nfs4_sequence_status_flags(status) \
  262. __print_flags((unsigned long)status, "|", \
  263. { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
  264. { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
  265. "CB_GSS_CONTEXTS_EXPIRING" }, \
  266. { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
  267. "CB_GSS_CONTEXTS_EXPIRED" }, \
  268. { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
  269. "EXPIRED_ALL_STATE_REVOKED" }, \
  270. { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
  271. "EXPIRED_SOME_STATE_REVOKED" }, \
  272. { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
  273. "ADMIN_STATE_REVOKED" }, \
  274. { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
  275. "RECALLABLE_STATE_REVOKED" }, \
  276. { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
  277. { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
  278. "RESTART_RECLAIM_NEEDED" }, \
  279. { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
  280. "CB_PATH_DOWN_SESSION" }, \
  281. { SEQ4_STATUS_BACKCHANNEL_FAULT, \
  282. "BACKCHANNEL_FAULT" })
  283. TRACE_EVENT(nfs4_sequence_done,
  284. TP_PROTO(
  285. const struct nfs4_session *session,
  286. const struct nfs4_sequence_res *res
  287. ),
  288. TP_ARGS(session, res),
  289. TP_STRUCT__entry(
  290. __field(unsigned int, session)
  291. __field(unsigned int, slot_nr)
  292. __field(unsigned int, seq_nr)
  293. __field(unsigned int, highest_slotid)
  294. __field(unsigned int, target_highest_slotid)
  295. __field(unsigned int, status_flags)
  296. __field(int, error)
  297. ),
  298. TP_fast_assign(
  299. const struct nfs4_slot *sr_slot = res->sr_slot;
  300. __entry->session = nfs_session_id_hash(&session->sess_id);
  301. __entry->slot_nr = sr_slot->slot_nr;
  302. __entry->seq_nr = sr_slot->seq_nr;
  303. __entry->highest_slotid = res->sr_highest_slotid;
  304. __entry->target_highest_slotid =
  305. res->sr_target_highest_slotid;
  306. __entry->error = res->sr_status;
  307. ),
  308. TP_printk(
  309. "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
  310. "highest_slotid=%u target_highest_slotid=%u "
  311. "status_flags=%u (%s)",
  312. __entry->error,
  313. show_nfsv4_errors(__entry->error),
  314. __entry->session,
  315. __entry->slot_nr,
  316. __entry->seq_nr,
  317. __entry->highest_slotid,
  318. __entry->target_highest_slotid,
  319. __entry->status_flags,
  320. show_nfs4_sequence_status_flags(__entry->status_flags)
  321. )
  322. );
  323. struct cb_sequenceargs;
  324. struct cb_sequenceres;
  325. TRACE_EVENT(nfs4_cb_sequence,
  326. TP_PROTO(
  327. const struct cb_sequenceargs *args,
  328. const struct cb_sequenceres *res,
  329. __be32 status
  330. ),
  331. TP_ARGS(args, res, status),
  332. TP_STRUCT__entry(
  333. __field(unsigned int, session)
  334. __field(unsigned int, slot_nr)
  335. __field(unsigned int, seq_nr)
  336. __field(unsigned int, highest_slotid)
  337. __field(unsigned int, cachethis)
  338. __field(int, error)
  339. ),
  340. TP_fast_assign(
  341. __entry->session = nfs_session_id_hash(&args->csa_sessionid);
  342. __entry->slot_nr = args->csa_slotid;
  343. __entry->seq_nr = args->csa_sequenceid;
  344. __entry->highest_slotid = args->csa_highestslotid;
  345. __entry->cachethis = args->csa_cachethis;
  346. __entry->error = -be32_to_cpu(status);
  347. ),
  348. TP_printk(
  349. "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
  350. "highest_slotid=%u",
  351. __entry->error,
  352. show_nfsv4_errors(__entry->error),
  353. __entry->session,
  354. __entry->slot_nr,
  355. __entry->seq_nr,
  356. __entry->highest_slotid
  357. )
  358. );
  359. #endif /* CONFIG_NFS_V4_1 */
  360. DECLARE_EVENT_CLASS(nfs4_open_event,
  361. TP_PROTO(
  362. const struct nfs_open_context *ctx,
  363. int flags,
  364. int error
  365. ),
  366. TP_ARGS(ctx, flags, error),
  367. TP_STRUCT__entry(
  368. __field(int, error)
  369. __field(unsigned int, flags)
  370. __field(unsigned int, fmode)
  371. __field(dev_t, dev)
  372. __field(u32, fhandle)
  373. __field(u64, fileid)
  374. __field(u64, dir)
  375. __string(name, ctx->dentry->d_name.name)
  376. ),
  377. TP_fast_assign(
  378. const struct nfs4_state *state = ctx->state;
  379. const struct inode *inode = NULL;
  380. __entry->error = error;
  381. __entry->flags = flags;
  382. __entry->fmode = (__force unsigned int)ctx->mode;
  383. __entry->dev = ctx->dentry->d_sb->s_dev;
  384. if (!IS_ERR_OR_NULL(state))
  385. inode = state->inode;
  386. if (inode != NULL) {
  387. __entry->fileid = NFS_FILEID(inode);
  388. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  389. } else {
  390. __entry->fileid = 0;
  391. __entry->fhandle = 0;
  392. }
  393. __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
  394. __assign_str(name, ctx->dentry->d_name.name);
  395. ),
  396. TP_printk(
  397. "error=%d (%s) flags=%d (%s) fmode=%s "
  398. "fileid=%02x:%02x:%llu fhandle=0x%08x "
  399. "name=%02x:%02x:%llu/%s",
  400. __entry->error,
  401. show_nfsv4_errors(__entry->error),
  402. __entry->flags,
  403. show_open_flags(__entry->flags),
  404. show_fmode_flags(__entry->fmode),
  405. MAJOR(__entry->dev), MINOR(__entry->dev),
  406. (unsigned long long)__entry->fileid,
  407. __entry->fhandle,
  408. MAJOR(__entry->dev), MINOR(__entry->dev),
  409. (unsigned long long)__entry->dir,
  410. __get_str(name)
  411. )
  412. );
  413. #define DEFINE_NFS4_OPEN_EVENT(name) \
  414. DEFINE_EVENT(nfs4_open_event, name, \
  415. TP_PROTO( \
  416. const struct nfs_open_context *ctx, \
  417. int flags, \
  418. int error \
  419. ), \
  420. TP_ARGS(ctx, flags, error))
  421. DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
  422. DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
  423. DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
  424. TRACE_EVENT(nfs4_close,
  425. TP_PROTO(
  426. const struct nfs4_state *state,
  427. const struct nfs_closeargs *args,
  428. const struct nfs_closeres *res,
  429. int error
  430. ),
  431. TP_ARGS(state, args, res, error),
  432. TP_STRUCT__entry(
  433. __field(dev_t, dev)
  434. __field(u32, fhandle)
  435. __field(u64, fileid)
  436. __field(unsigned int, fmode)
  437. __field(int, error)
  438. ),
  439. TP_fast_assign(
  440. const struct inode *inode = state->inode;
  441. __entry->dev = inode->i_sb->s_dev;
  442. __entry->fileid = NFS_FILEID(inode);
  443. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  444. __entry->fmode = (__force unsigned int)state->state;
  445. __entry->error = error;
  446. ),
  447. TP_printk(
  448. "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
  449. "fhandle=0x%08x",
  450. __entry->error,
  451. show_nfsv4_errors(__entry->error),
  452. __entry->fmode ? show_fmode_flags(__entry->fmode) :
  453. "closed",
  454. MAJOR(__entry->dev), MINOR(__entry->dev),
  455. (unsigned long long)__entry->fileid,
  456. __entry->fhandle
  457. )
  458. );
  459. #define show_lock_cmd(type) \
  460. __print_symbolic((int)type, \
  461. { F_GETLK, "GETLK" }, \
  462. { F_SETLK, "SETLK" }, \
  463. { F_SETLKW, "SETLKW" })
  464. #define show_lock_type(type) \
  465. __print_symbolic((int)type, \
  466. { F_RDLCK, "RDLCK" }, \
  467. { F_WRLCK, "WRLCK" }, \
  468. { F_UNLCK, "UNLCK" })
  469. DECLARE_EVENT_CLASS(nfs4_lock_event,
  470. TP_PROTO(
  471. const struct file_lock *request,
  472. const struct nfs4_state *state,
  473. int cmd,
  474. int error
  475. ),
  476. TP_ARGS(request, state, cmd, error),
  477. TP_STRUCT__entry(
  478. __field(int, error)
  479. __field(int, cmd)
  480. __field(char, type)
  481. __field(loff_t, start)
  482. __field(loff_t, end)
  483. __field(dev_t, dev)
  484. __field(u32, fhandle)
  485. __field(u64, fileid)
  486. ),
  487. TP_fast_assign(
  488. const struct inode *inode = state->inode;
  489. __entry->error = error;
  490. __entry->cmd = cmd;
  491. __entry->type = request->fl_type;
  492. __entry->start = request->fl_start;
  493. __entry->end = request->fl_end;
  494. __entry->dev = inode->i_sb->s_dev;
  495. __entry->fileid = NFS_FILEID(inode);
  496. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  497. ),
  498. TP_printk(
  499. "error=%d (%s) cmd=%s:%s range=%lld:%lld "
  500. "fileid=%02x:%02x:%llu fhandle=0x%08x",
  501. __entry->error,
  502. show_nfsv4_errors(__entry->error),
  503. show_lock_cmd(__entry->cmd),
  504. show_lock_type(__entry->type),
  505. (long long)__entry->start,
  506. (long long)__entry->end,
  507. MAJOR(__entry->dev), MINOR(__entry->dev),
  508. (unsigned long long)__entry->fileid,
  509. __entry->fhandle
  510. )
  511. );
  512. #define DEFINE_NFS4_LOCK_EVENT(name) \
  513. DEFINE_EVENT(nfs4_lock_event, name, \
  514. TP_PROTO( \
  515. const struct file_lock *request, \
  516. const struct nfs4_state *state, \
  517. int cmd, \
  518. int error \
  519. ), \
  520. TP_ARGS(request, state, cmd, error))
  521. DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
  522. DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock);
  523. DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim);
  524. DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired);
  525. DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
  526. DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
  527. TP_PROTO(
  528. const struct inode *inode,
  529. fmode_t fmode
  530. ),
  531. TP_ARGS(inode, fmode),
  532. TP_STRUCT__entry(
  533. __field(dev_t, dev)
  534. __field(u32, fhandle)
  535. __field(u64, fileid)
  536. __field(unsigned int, fmode)
  537. ),
  538. TP_fast_assign(
  539. __entry->dev = inode->i_sb->s_dev;
  540. __entry->fileid = NFS_FILEID(inode);
  541. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  542. __entry->fmode = (__force unsigned int)fmode;
  543. ),
  544. TP_printk(
  545. "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
  546. show_fmode_flags(__entry->fmode),
  547. MAJOR(__entry->dev), MINOR(__entry->dev),
  548. (unsigned long long)__entry->fileid,
  549. __entry->fhandle
  550. )
  551. );
  552. #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
  553. DEFINE_EVENT(nfs4_set_delegation_event, name, \
  554. TP_PROTO( \
  555. const struct inode *inode, \
  556. fmode_t fmode \
  557. ), \
  558. TP_ARGS(inode, fmode))
  559. DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
  560. DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
  561. TRACE_EVENT(nfs4_delegreturn_exit,
  562. TP_PROTO(
  563. const struct nfs4_delegreturnargs *args,
  564. const struct nfs4_delegreturnres *res,
  565. int error
  566. ),
  567. TP_ARGS(args, res, error),
  568. TP_STRUCT__entry(
  569. __field(dev_t, dev)
  570. __field(u32, fhandle)
  571. __field(int, error)
  572. ),
  573. TP_fast_assign(
  574. __entry->dev = res->server->s_dev;
  575. __entry->fhandle = nfs_fhandle_hash(args->fhandle);
  576. __entry->error = error;
  577. ),
  578. TP_printk(
  579. "error=%d (%s) dev=%02x:%02x fhandle=0x%08x",
  580. __entry->error,
  581. show_nfsv4_errors(__entry->error),
  582. MAJOR(__entry->dev), MINOR(__entry->dev),
  583. __entry->fhandle
  584. )
  585. );
  586. #ifdef CONFIG_NFS_V4_1
  587. DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
  588. TP_PROTO(
  589. const struct nfs4_state *state,
  590. const struct nfs4_lock_state *lsp,
  591. int error
  592. ),
  593. TP_ARGS(state, lsp, error),
  594. TP_STRUCT__entry(
  595. __field(int, error)
  596. __field(dev_t, dev)
  597. __field(u32, fhandle)
  598. __field(u64, fileid)
  599. ),
  600. TP_fast_assign(
  601. const struct inode *inode = state->inode;
  602. __entry->error = error;
  603. __entry->dev = inode->i_sb->s_dev;
  604. __entry->fileid = NFS_FILEID(inode);
  605. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  606. ),
  607. TP_printk(
  608. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
  609. __entry->error,
  610. show_nfsv4_errors(__entry->error),
  611. MAJOR(__entry->dev), MINOR(__entry->dev),
  612. (unsigned long long)__entry->fileid,
  613. __entry->fhandle
  614. )
  615. );
  616. #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
  617. DEFINE_EVENT(nfs4_test_stateid_event, name, \
  618. TP_PROTO( \
  619. const struct nfs4_state *state, \
  620. const struct nfs4_lock_state *lsp, \
  621. int error \
  622. ), \
  623. TP_ARGS(state, lsp, error))
  624. DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
  625. DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
  626. DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
  627. #endif /* CONFIG_NFS_V4_1 */
  628. DECLARE_EVENT_CLASS(nfs4_lookup_event,
  629. TP_PROTO(
  630. const struct inode *dir,
  631. const struct qstr *name,
  632. int error
  633. ),
  634. TP_ARGS(dir, name, error),
  635. TP_STRUCT__entry(
  636. __field(dev_t, dev)
  637. __field(int, error)
  638. __field(u64, dir)
  639. __string(name, name->name)
  640. ),
  641. TP_fast_assign(
  642. __entry->dev = dir->i_sb->s_dev;
  643. __entry->dir = NFS_FILEID(dir);
  644. __entry->error = error;
  645. __assign_str(name, name->name);
  646. ),
  647. TP_printk(
  648. "error=%d (%s) name=%02x:%02x:%llu/%s",
  649. __entry->error,
  650. show_nfsv4_errors(__entry->error),
  651. MAJOR(__entry->dev), MINOR(__entry->dev),
  652. (unsigned long long)__entry->dir,
  653. __get_str(name)
  654. )
  655. );
  656. #define DEFINE_NFS4_LOOKUP_EVENT(name) \
  657. DEFINE_EVENT(nfs4_lookup_event, name, \
  658. TP_PROTO( \
  659. const struct inode *dir, \
  660. const struct qstr *name, \
  661. int error \
  662. ), \
  663. TP_ARGS(dir, name, error))
  664. DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
  665. DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
  666. DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
  667. DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
  668. DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
  669. DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
  670. DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
  671. TRACE_EVENT(nfs4_rename,
  672. TP_PROTO(
  673. const struct inode *olddir,
  674. const struct qstr *oldname,
  675. const struct inode *newdir,
  676. const struct qstr *newname,
  677. int error
  678. ),
  679. TP_ARGS(olddir, oldname, newdir, newname, error),
  680. TP_STRUCT__entry(
  681. __field(dev_t, dev)
  682. __field(int, error)
  683. __field(u64, olddir)
  684. __string(oldname, oldname->name)
  685. __field(u64, newdir)
  686. __string(newname, newname->name)
  687. ),
  688. TP_fast_assign(
  689. __entry->dev = olddir->i_sb->s_dev;
  690. __entry->olddir = NFS_FILEID(olddir);
  691. __entry->newdir = NFS_FILEID(newdir);
  692. __entry->error = error;
  693. __assign_str(oldname, oldname->name);
  694. __assign_str(newname, newname->name);
  695. ),
  696. TP_printk(
  697. "error=%d (%s) oldname=%02x:%02x:%llu/%s "
  698. "newname=%02x:%02x:%llu/%s",
  699. __entry->error,
  700. show_nfsv4_errors(__entry->error),
  701. MAJOR(__entry->dev), MINOR(__entry->dev),
  702. (unsigned long long)__entry->olddir,
  703. __get_str(oldname),
  704. MAJOR(__entry->dev), MINOR(__entry->dev),
  705. (unsigned long long)__entry->newdir,
  706. __get_str(newname)
  707. )
  708. );
  709. DECLARE_EVENT_CLASS(nfs4_inode_event,
  710. TP_PROTO(
  711. const struct inode *inode,
  712. int error
  713. ),
  714. TP_ARGS(inode, error),
  715. TP_STRUCT__entry(
  716. __field(dev_t, dev)
  717. __field(u32, fhandle)
  718. __field(u64, fileid)
  719. __field(int, error)
  720. ),
  721. TP_fast_assign(
  722. __entry->dev = inode->i_sb->s_dev;
  723. __entry->fileid = NFS_FILEID(inode);
  724. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  725. __entry->error = error;
  726. ),
  727. TP_printk(
  728. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
  729. __entry->error,
  730. show_nfsv4_errors(__entry->error),
  731. MAJOR(__entry->dev), MINOR(__entry->dev),
  732. (unsigned long long)__entry->fileid,
  733. __entry->fhandle
  734. )
  735. );
  736. #define DEFINE_NFS4_INODE_EVENT(name) \
  737. DEFINE_EVENT(nfs4_inode_event, name, \
  738. TP_PROTO( \
  739. const struct inode *inode, \
  740. int error \
  741. ), \
  742. TP_ARGS(inode, error))
  743. DEFINE_NFS4_INODE_EVENT(nfs4_setattr);
  744. DEFINE_NFS4_INODE_EVENT(nfs4_access);
  745. DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
  746. DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
  747. DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
  748. DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
  749. #ifdef CONFIG_NFS_V4_SECURITY_LABEL
  750. DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
  751. DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
  752. #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
  753. DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
  754. DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn);
  755. DECLARE_EVENT_CLASS(nfs4_getattr_event,
  756. TP_PROTO(
  757. const struct nfs_server *server,
  758. const struct nfs_fh *fhandle,
  759. const struct nfs_fattr *fattr,
  760. int error
  761. ),
  762. TP_ARGS(server, fhandle, fattr, error),
  763. TP_STRUCT__entry(
  764. __field(dev_t, dev)
  765. __field(u32, fhandle)
  766. __field(u64, fileid)
  767. __field(unsigned int, valid)
  768. __field(int, error)
  769. ),
  770. TP_fast_assign(
  771. __entry->dev = server->s_dev;
  772. __entry->valid = fattr->valid;
  773. __entry->fhandle = nfs_fhandle_hash(fhandle);
  774. __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
  775. __entry->error = error;
  776. ),
  777. TP_printk(
  778. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  779. "valid=%s",
  780. __entry->error,
  781. show_nfsv4_errors(__entry->error),
  782. MAJOR(__entry->dev), MINOR(__entry->dev),
  783. (unsigned long long)__entry->fileid,
  784. __entry->fhandle,
  785. show_nfs_fattr_flags(__entry->valid)
  786. )
  787. );
  788. #define DEFINE_NFS4_GETATTR_EVENT(name) \
  789. DEFINE_EVENT(nfs4_getattr_event, name, \
  790. TP_PROTO( \
  791. const struct nfs_server *server, \
  792. const struct nfs_fh *fhandle, \
  793. const struct nfs_fattr *fattr, \
  794. int error \
  795. ), \
  796. TP_ARGS(server, fhandle, fattr, error))
  797. DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
  798. DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
  799. DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
  800. DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
  801. TP_PROTO(
  802. const struct nfs_client *clp,
  803. const struct nfs_fh *fhandle,
  804. const struct inode *inode,
  805. int error
  806. ),
  807. TP_ARGS(clp, fhandle, inode, error),
  808. TP_STRUCT__entry(
  809. __field(int, error)
  810. __field(dev_t, dev)
  811. __field(u32, fhandle)
  812. __field(u64, fileid)
  813. __string(dstaddr, clp ?
  814. rpc_peeraddr2str(clp->cl_rpcclient,
  815. RPC_DISPLAY_ADDR) : "unknown")
  816. ),
  817. TP_fast_assign(
  818. __entry->error = error;
  819. __entry->fhandle = nfs_fhandle_hash(fhandle);
  820. if (inode != NULL) {
  821. __entry->fileid = NFS_FILEID(inode);
  822. __entry->dev = inode->i_sb->s_dev;
  823. } else {
  824. __entry->fileid = 0;
  825. __entry->dev = 0;
  826. }
  827. __assign_str(dstaddr, clp ?
  828. rpc_peeraddr2str(clp->cl_rpcclient,
  829. RPC_DISPLAY_ADDR) : "unknown")
  830. ),
  831. TP_printk(
  832. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  833. "dstaddr=%s",
  834. __entry->error,
  835. show_nfsv4_errors(__entry->error),
  836. MAJOR(__entry->dev), MINOR(__entry->dev),
  837. (unsigned long long)__entry->fileid,
  838. __entry->fhandle,
  839. __get_str(dstaddr)
  840. )
  841. );
  842. #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
  843. DEFINE_EVENT(nfs4_inode_callback_event, name, \
  844. TP_PROTO( \
  845. const struct nfs_client *clp, \
  846. const struct nfs_fh *fhandle, \
  847. const struct inode *inode, \
  848. int error \
  849. ), \
  850. TP_ARGS(clp, fhandle, inode, error))
  851. DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
  852. DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_layoutrecall_inode);
  853. DECLARE_EVENT_CLASS(nfs4_idmap_event,
  854. TP_PROTO(
  855. const char *name,
  856. int len,
  857. u32 id,
  858. int error
  859. ),
  860. TP_ARGS(name, len, id, error),
  861. TP_STRUCT__entry(
  862. __field(int, error)
  863. __field(u32, id)
  864. __dynamic_array(char, name, len > 0 ? len + 1 : 1)
  865. ),
  866. TP_fast_assign(
  867. if (len < 0)
  868. len = 0;
  869. __entry->error = error < 0 ? error : 0;
  870. __entry->id = id;
  871. memcpy(__get_dynamic_array(name), name, len);
  872. ((char *)__get_dynamic_array(name))[len] = 0;
  873. ),
  874. TP_printk(
  875. "error=%d id=%u name=%s",
  876. __entry->error,
  877. __entry->id,
  878. __get_str(name)
  879. )
  880. );
  881. #define DEFINE_NFS4_IDMAP_EVENT(name) \
  882. DEFINE_EVENT(nfs4_idmap_event, name, \
  883. TP_PROTO( \
  884. const char *name, \
  885. int len, \
  886. u32 id, \
  887. int error \
  888. ), \
  889. TP_ARGS(name, len, id, error))
  890. DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
  891. DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
  892. DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
  893. DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
  894. DECLARE_EVENT_CLASS(nfs4_read_event,
  895. TP_PROTO(
  896. const struct nfs_pgio_header *hdr,
  897. int error
  898. ),
  899. TP_ARGS(hdr, error),
  900. TP_STRUCT__entry(
  901. __field(dev_t, dev)
  902. __field(u32, fhandle)
  903. __field(u64, fileid)
  904. __field(loff_t, offset)
  905. __field(size_t, count)
  906. __field(int, error)
  907. ),
  908. TP_fast_assign(
  909. const struct inode *inode = hdr->inode;
  910. __entry->dev = inode->i_sb->s_dev;
  911. __entry->fileid = NFS_FILEID(inode);
  912. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  913. __entry->offset = hdr->args.offset;
  914. __entry->count = hdr->args.count;
  915. __entry->error = error;
  916. ),
  917. TP_printk(
  918. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  919. "offset=%lld count=%zu",
  920. __entry->error,
  921. show_nfsv4_errors(__entry->error),
  922. MAJOR(__entry->dev), MINOR(__entry->dev),
  923. (unsigned long long)__entry->fileid,
  924. __entry->fhandle,
  925. (long long)__entry->offset,
  926. __entry->count
  927. )
  928. );
  929. #define DEFINE_NFS4_READ_EVENT(name) \
  930. DEFINE_EVENT(nfs4_read_event, name, \
  931. TP_PROTO( \
  932. const struct nfs_pgio_header *hdr, \
  933. int error \
  934. ), \
  935. TP_ARGS(hdr, error))
  936. DEFINE_NFS4_READ_EVENT(nfs4_read);
  937. #ifdef CONFIG_NFS_V4_1
  938. DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
  939. #endif /* CONFIG_NFS_V4_1 */
  940. DECLARE_EVENT_CLASS(nfs4_write_event,
  941. TP_PROTO(
  942. const struct nfs_pgio_header *hdr,
  943. int error
  944. ),
  945. TP_ARGS(hdr, error),
  946. TP_STRUCT__entry(
  947. __field(dev_t, dev)
  948. __field(u32, fhandle)
  949. __field(u64, fileid)
  950. __field(loff_t, offset)
  951. __field(size_t, count)
  952. __field(int, error)
  953. ),
  954. TP_fast_assign(
  955. const struct inode *inode = hdr->inode;
  956. __entry->dev = inode->i_sb->s_dev;
  957. __entry->fileid = NFS_FILEID(inode);
  958. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  959. __entry->offset = hdr->args.offset;
  960. __entry->count = hdr->args.count;
  961. __entry->error = error;
  962. ),
  963. TP_printk(
  964. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  965. "offset=%lld count=%zu",
  966. __entry->error,
  967. show_nfsv4_errors(__entry->error),
  968. MAJOR(__entry->dev), MINOR(__entry->dev),
  969. (unsigned long long)__entry->fileid,
  970. __entry->fhandle,
  971. (long long)__entry->offset,
  972. __entry->count
  973. )
  974. );
  975. #define DEFINE_NFS4_WRITE_EVENT(name) \
  976. DEFINE_EVENT(nfs4_write_event, name, \
  977. TP_PROTO( \
  978. const struct nfs_pgio_header *hdr, \
  979. int error \
  980. ), \
  981. TP_ARGS(hdr, error))
  982. DEFINE_NFS4_WRITE_EVENT(nfs4_write);
  983. #ifdef CONFIG_NFS_V4_1
  984. DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
  985. #endif /* CONFIG_NFS_V4_1 */
  986. DECLARE_EVENT_CLASS(nfs4_commit_event,
  987. TP_PROTO(
  988. const struct nfs_commit_data *data,
  989. int error
  990. ),
  991. TP_ARGS(data, error),
  992. TP_STRUCT__entry(
  993. __field(dev_t, dev)
  994. __field(u32, fhandle)
  995. __field(u64, fileid)
  996. __field(loff_t, offset)
  997. __field(size_t, count)
  998. __field(int, error)
  999. ),
  1000. TP_fast_assign(
  1001. const struct inode *inode = data->inode;
  1002. __entry->dev = inode->i_sb->s_dev;
  1003. __entry->fileid = NFS_FILEID(inode);
  1004. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  1005. __entry->offset = data->args.offset;
  1006. __entry->count = data->args.count;
  1007. __entry->error = error;
  1008. ),
  1009. TP_printk(
  1010. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  1011. "offset=%lld count=%zu",
  1012. __entry->error,
  1013. show_nfsv4_errors(__entry->error),
  1014. MAJOR(__entry->dev), MINOR(__entry->dev),
  1015. (unsigned long long)__entry->fileid,
  1016. __entry->fhandle,
  1017. (long long)__entry->offset,
  1018. __entry->count
  1019. )
  1020. );
  1021. #define DEFINE_NFS4_COMMIT_EVENT(name) \
  1022. DEFINE_EVENT(nfs4_commit_event, name, \
  1023. TP_PROTO( \
  1024. const struct nfs_commit_data *data, \
  1025. int error \
  1026. ), \
  1027. TP_ARGS(data, error))
  1028. DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
  1029. #ifdef CONFIG_NFS_V4_1
  1030. DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
  1031. #define show_pnfs_iomode(iomode) \
  1032. __print_symbolic(iomode, \
  1033. { IOMODE_READ, "READ" }, \
  1034. { IOMODE_RW, "RW" }, \
  1035. { IOMODE_ANY, "ANY" })
  1036. TRACE_EVENT(nfs4_layoutget,
  1037. TP_PROTO(
  1038. const struct nfs_open_context *ctx,
  1039. const struct pnfs_layout_range *args,
  1040. const struct pnfs_layout_range *res,
  1041. int error
  1042. ),
  1043. TP_ARGS(ctx, args, res, error),
  1044. TP_STRUCT__entry(
  1045. __field(dev_t, dev)
  1046. __field(u32, fhandle)
  1047. __field(u64, fileid)
  1048. __field(u32, iomode)
  1049. __field(u64, offset)
  1050. __field(u64, count)
  1051. __field(int, error)
  1052. ),
  1053. TP_fast_assign(
  1054. const struct inode *inode = d_inode(ctx->dentry);
  1055. __entry->dev = inode->i_sb->s_dev;
  1056. __entry->fileid = NFS_FILEID(inode);
  1057. __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
  1058. __entry->iomode = args->iomode;
  1059. __entry->offset = args->offset;
  1060. __entry->count = args->length;
  1061. __entry->error = error;
  1062. ),
  1063. TP_printk(
  1064. "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
  1065. "iomode=%s offset=%llu count=%llu",
  1066. __entry->error,
  1067. show_nfsv4_errors(__entry->error),
  1068. MAJOR(__entry->dev), MINOR(__entry->dev),
  1069. (unsigned long long)__entry->fileid,
  1070. __entry->fhandle,
  1071. show_pnfs_iomode(__entry->iomode),
  1072. (unsigned long long)__entry->offset,
  1073. (unsigned long long)__entry->count
  1074. )
  1075. );
  1076. DEFINE_NFS4_INODE_EVENT(nfs4_layoutcommit);
  1077. DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn);
  1078. DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
  1079. #endif /* CONFIG_NFS_V4_1 */
  1080. #endif /* _TRACE_NFS4_H */
  1081. #undef TRACE_INCLUDE_PATH
  1082. #define TRACE_INCLUDE_PATH .
  1083. #define TRACE_INCLUDE_FILE nfs4trace
  1084. /* This part must be outside protection */
  1085. #include <trace/define_trace.h>