PageRenderTime 204ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/fs/cifs/trace.h

https://github.com/kvaneesh/linux
C Header | 945 lines | 835 code | 83 blank | 27 comment | 1 complexity | 865439bb96a2e7a203e989b1905edbad MD5 | raw file
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2018, Microsoft Corporation.
  4. *
  5. * Author(s): Steve French <stfrench@microsoft.com>
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM cifs
  9. #if !defined(_CIFS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _CIFS_TRACE_H
  11. #include <linux/tracepoint.h>
  12. /*
  13. * Please use this 3-part article as a reference for writing new tracepoints:
  14. * https://lwn.net/Articles/379903/
  15. */
  16. /* For logging errors in read or write */
  17. DECLARE_EVENT_CLASS(smb3_rw_err_class,
  18. TP_PROTO(unsigned int xid,
  19. __u64 fid,
  20. __u32 tid,
  21. __u64 sesid,
  22. __u64 offset,
  23. __u32 len,
  24. int rc),
  25. TP_ARGS(xid, fid, tid, sesid, offset, len, rc),
  26. TP_STRUCT__entry(
  27. __field(unsigned int, xid)
  28. __field(__u64, fid)
  29. __field(__u32, tid)
  30. __field(__u64, sesid)
  31. __field(__u64, offset)
  32. __field(__u32, len)
  33. __field(int, rc)
  34. ),
  35. TP_fast_assign(
  36. __entry->xid = xid;
  37. __entry->fid = fid;
  38. __entry->tid = tid;
  39. __entry->sesid = sesid;
  40. __entry->offset = offset;
  41. __entry->len = len;
  42. __entry->rc = rc;
  43. ),
  44. TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d",
  45. __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
  46. __entry->offset, __entry->len, __entry->rc)
  47. )
  48. #define DEFINE_SMB3_RW_ERR_EVENT(name) \
  49. DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \
  50. TP_PROTO(unsigned int xid, \
  51. __u64 fid, \
  52. __u32 tid, \
  53. __u64 sesid, \
  54. __u64 offset, \
  55. __u32 len, \
  56. int rc), \
  57. TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
  58. DEFINE_SMB3_RW_ERR_EVENT(write_err);
  59. DEFINE_SMB3_RW_ERR_EVENT(read_err);
  60. DEFINE_SMB3_RW_ERR_EVENT(query_dir_err);
  61. DEFINE_SMB3_RW_ERR_EVENT(zero_err);
  62. DEFINE_SMB3_RW_ERR_EVENT(falloc_err);
  63. /* For logging successful read or write */
  64. DECLARE_EVENT_CLASS(smb3_rw_done_class,
  65. TP_PROTO(unsigned int xid,
  66. __u64 fid,
  67. __u32 tid,
  68. __u64 sesid,
  69. __u64 offset,
  70. __u32 len),
  71. TP_ARGS(xid, fid, tid, sesid, offset, len),
  72. TP_STRUCT__entry(
  73. __field(unsigned int, xid)
  74. __field(__u64, fid)
  75. __field(__u32, tid)
  76. __field(__u64, sesid)
  77. __field(__u64, offset)
  78. __field(__u32, len)
  79. ),
  80. TP_fast_assign(
  81. __entry->xid = xid;
  82. __entry->fid = fid;
  83. __entry->tid = tid;
  84. __entry->sesid = sesid;
  85. __entry->offset = offset;
  86. __entry->len = len;
  87. ),
  88. TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
  89. __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
  90. __entry->offset, __entry->len)
  91. )
  92. #define DEFINE_SMB3_RW_DONE_EVENT(name) \
  93. DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \
  94. TP_PROTO(unsigned int xid, \
  95. __u64 fid, \
  96. __u32 tid, \
  97. __u64 sesid, \
  98. __u64 offset, \
  99. __u32 len), \
  100. TP_ARGS(xid, fid, tid, sesid, offset, len))
  101. DEFINE_SMB3_RW_DONE_EVENT(write_enter);
  102. DEFINE_SMB3_RW_DONE_EVENT(read_enter);
  103. DEFINE_SMB3_RW_DONE_EVENT(query_dir_enter);
  104. DEFINE_SMB3_RW_DONE_EVENT(zero_enter);
  105. DEFINE_SMB3_RW_DONE_EVENT(falloc_enter);
  106. DEFINE_SMB3_RW_DONE_EVENT(write_done);
  107. DEFINE_SMB3_RW_DONE_EVENT(read_done);
  108. DEFINE_SMB3_RW_DONE_EVENT(query_dir_done);
  109. DEFINE_SMB3_RW_DONE_EVENT(zero_done);
  110. DEFINE_SMB3_RW_DONE_EVENT(falloc_done);
  111. /*
  112. * For handle based calls other than read and write, and get/set info
  113. */
  114. DECLARE_EVENT_CLASS(smb3_fd_class,
  115. TP_PROTO(unsigned int xid,
  116. __u64 fid,
  117. __u32 tid,
  118. __u64 sesid),
  119. TP_ARGS(xid, fid, tid, sesid),
  120. TP_STRUCT__entry(
  121. __field(unsigned int, xid)
  122. __field(__u64, fid)
  123. __field(__u32, tid)
  124. __field(__u64, sesid)
  125. ),
  126. TP_fast_assign(
  127. __entry->xid = xid;
  128. __entry->fid = fid;
  129. __entry->tid = tid;
  130. __entry->sesid = sesid;
  131. ),
  132. TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx",
  133. __entry->xid, __entry->sesid, __entry->tid, __entry->fid)
  134. )
  135. #define DEFINE_SMB3_FD_EVENT(name) \
  136. DEFINE_EVENT(smb3_fd_class, smb3_##name, \
  137. TP_PROTO(unsigned int xid, \
  138. __u64 fid, \
  139. __u32 tid, \
  140. __u64 sesid), \
  141. TP_ARGS(xid, fid, tid, sesid))
  142. DEFINE_SMB3_FD_EVENT(flush_enter);
  143. DEFINE_SMB3_FD_EVENT(flush_done);
  144. DEFINE_SMB3_FD_EVENT(close_enter);
  145. DEFINE_SMB3_FD_EVENT(close_done);
  146. DECLARE_EVENT_CLASS(smb3_fd_err_class,
  147. TP_PROTO(unsigned int xid,
  148. __u64 fid,
  149. __u32 tid,
  150. __u64 sesid,
  151. int rc),
  152. TP_ARGS(xid, fid, tid, sesid, rc),
  153. TP_STRUCT__entry(
  154. __field(unsigned int, xid)
  155. __field(__u64, fid)
  156. __field(__u32, tid)
  157. __field(__u64, sesid)
  158. __field(int, rc)
  159. ),
  160. TP_fast_assign(
  161. __entry->xid = xid;
  162. __entry->fid = fid;
  163. __entry->tid = tid;
  164. __entry->sesid = sesid;
  165. __entry->rc = rc;
  166. ),
  167. TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
  168. __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
  169. __entry->rc)
  170. )
  171. #define DEFINE_SMB3_FD_ERR_EVENT(name) \
  172. DEFINE_EVENT(smb3_fd_err_class, smb3_##name, \
  173. TP_PROTO(unsigned int xid, \
  174. __u64 fid, \
  175. __u32 tid, \
  176. __u64 sesid, \
  177. int rc), \
  178. TP_ARGS(xid, fid, tid, sesid, rc))
  179. DEFINE_SMB3_FD_ERR_EVENT(flush_err);
  180. DEFINE_SMB3_FD_ERR_EVENT(lock_err);
  181. DEFINE_SMB3_FD_ERR_EVENT(close_err);
  182. /*
  183. * For handle based query/set info calls
  184. */
  185. DECLARE_EVENT_CLASS(smb3_inf_enter_class,
  186. TP_PROTO(unsigned int xid,
  187. __u64 fid,
  188. __u32 tid,
  189. __u64 sesid,
  190. __u8 infclass,
  191. __u32 type),
  192. TP_ARGS(xid, fid, tid, sesid, infclass, type),
  193. TP_STRUCT__entry(
  194. __field(unsigned int, xid)
  195. __field(__u64, fid)
  196. __field(__u32, tid)
  197. __field(__u64, sesid)
  198. __field(__u8, infclass)
  199. __field(__u32, type)
  200. ),
  201. TP_fast_assign(
  202. __entry->xid = xid;
  203. __entry->fid = fid;
  204. __entry->tid = tid;
  205. __entry->sesid = sesid;
  206. __entry->infclass = infclass;
  207. __entry->type = type;
  208. ),
  209. TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x",
  210. __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
  211. __entry->infclass, __entry->type)
  212. )
  213. #define DEFINE_SMB3_INF_ENTER_EVENT(name) \
  214. DEFINE_EVENT(smb3_inf_enter_class, smb3_##name, \
  215. TP_PROTO(unsigned int xid, \
  216. __u64 fid, \
  217. __u32 tid, \
  218. __u64 sesid, \
  219. __u8 infclass, \
  220. __u32 type), \
  221. TP_ARGS(xid, fid, tid, sesid, infclass, type))
  222. DEFINE_SMB3_INF_ENTER_EVENT(query_info_enter);
  223. DEFINE_SMB3_INF_ENTER_EVENT(query_info_done);
  224. DEFINE_SMB3_INF_ENTER_EVENT(notify_enter);
  225. DEFINE_SMB3_INF_ENTER_EVENT(notify_done);
  226. DECLARE_EVENT_CLASS(smb3_inf_err_class,
  227. TP_PROTO(unsigned int xid,
  228. __u64 fid,
  229. __u32 tid,
  230. __u64 sesid,
  231. __u8 infclass,
  232. __u32 type,
  233. int rc),
  234. TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
  235. TP_STRUCT__entry(
  236. __field(unsigned int, xid)
  237. __field(__u64, fid)
  238. __field(__u32, tid)
  239. __field(__u64, sesid)
  240. __field(__u8, infclass)
  241. __field(__u32, type)
  242. __field(int, rc)
  243. ),
  244. TP_fast_assign(
  245. __entry->xid = xid;
  246. __entry->fid = fid;
  247. __entry->tid = tid;
  248. __entry->sesid = sesid;
  249. __entry->infclass = infclass;
  250. __entry->type = type;
  251. __entry->rc = rc;
  252. ),
  253. TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
  254. __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
  255. __entry->infclass, __entry->type, __entry->rc)
  256. )
  257. #define DEFINE_SMB3_INF_ERR_EVENT(name) \
  258. DEFINE_EVENT(smb3_inf_err_class, smb3_##name, \
  259. TP_PROTO(unsigned int xid, \
  260. __u64 fid, \
  261. __u32 tid, \
  262. __u64 sesid, \
  263. __u8 infclass, \
  264. __u32 type, \
  265. int rc), \
  266. TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
  267. DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
  268. DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
  269. DEFINE_SMB3_INF_ERR_EVENT(notify_err);
  270. DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
  271. DECLARE_EVENT_CLASS(smb3_inf_compound_enter_class,
  272. TP_PROTO(unsigned int xid,
  273. __u32 tid,
  274. __u64 sesid,
  275. const char *full_path),
  276. TP_ARGS(xid, tid, sesid, full_path),
  277. TP_STRUCT__entry(
  278. __field(unsigned int, xid)
  279. __field(__u32, tid)
  280. __field(__u64, sesid)
  281. __string(path, full_path)
  282. ),
  283. TP_fast_assign(
  284. __entry->xid = xid;
  285. __entry->tid = tid;
  286. __entry->sesid = sesid;
  287. __assign_str(path, full_path);
  288. ),
  289. TP_printk("xid=%u sid=0x%llx tid=0x%x path=%s",
  290. __entry->xid, __entry->sesid, __entry->tid,
  291. __get_str(path))
  292. )
  293. #define DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(name) \
  294. DEFINE_EVENT(smb3_inf_compound_enter_class, smb3_##name, \
  295. TP_PROTO(unsigned int xid, \
  296. __u32 tid, \
  297. __u64 sesid, \
  298. const char *full_path), \
  299. TP_ARGS(xid, tid, sesid, full_path))
  300. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(query_info_compound_enter);
  301. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(posix_query_info_compound_enter);
  302. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(hardlink_enter);
  303. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rename_enter);
  304. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(rmdir_enter);
  305. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_eof_enter);
  306. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(set_info_compound_enter);
  307. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(delete_enter);
  308. DEFINE_SMB3_INF_COMPOUND_ENTER_EVENT(mkdir_enter);
  309. DECLARE_EVENT_CLASS(smb3_inf_compound_done_class,
  310. TP_PROTO(unsigned int xid,
  311. __u32 tid,
  312. __u64 sesid),
  313. TP_ARGS(xid, tid, sesid),
  314. TP_STRUCT__entry(
  315. __field(unsigned int, xid)
  316. __field(__u32, tid)
  317. __field(__u64, sesid)
  318. ),
  319. TP_fast_assign(
  320. __entry->xid = xid;
  321. __entry->tid = tid;
  322. __entry->sesid = sesid;
  323. ),
  324. TP_printk("xid=%u sid=0x%llx tid=0x%x",
  325. __entry->xid, __entry->sesid, __entry->tid)
  326. )
  327. #define DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(name) \
  328. DEFINE_EVENT(smb3_inf_compound_done_class, smb3_##name, \
  329. TP_PROTO(unsigned int xid, \
  330. __u32 tid, \
  331. __u64 sesid), \
  332. TP_ARGS(xid, tid, sesid))
  333. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(query_info_compound_done);
  334. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(posix_query_info_compound_done);
  335. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(hardlink_done);
  336. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rename_done);
  337. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(rmdir_done);
  338. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_eof_done);
  339. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(set_info_compound_done);
  340. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(delete_done);
  341. DEFINE_SMB3_INF_COMPOUND_DONE_EVENT(mkdir_done);
  342. DECLARE_EVENT_CLASS(smb3_inf_compound_err_class,
  343. TP_PROTO(unsigned int xid,
  344. __u32 tid,
  345. __u64 sesid,
  346. int rc),
  347. TP_ARGS(xid, tid, sesid, rc),
  348. TP_STRUCT__entry(
  349. __field(unsigned int, xid)
  350. __field(__u32, tid)
  351. __field(__u64, sesid)
  352. __field(int, rc)
  353. ),
  354. TP_fast_assign(
  355. __entry->xid = xid;
  356. __entry->tid = tid;
  357. __entry->sesid = sesid;
  358. __entry->rc = rc;
  359. ),
  360. TP_printk("xid=%u sid=0x%llx tid=0x%x rc=%d",
  361. __entry->xid, __entry->sesid, __entry->tid,
  362. __entry->rc)
  363. )
  364. #define DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(name) \
  365. DEFINE_EVENT(smb3_inf_compound_err_class, smb3_##name, \
  366. TP_PROTO(unsigned int xid, \
  367. __u32 tid, \
  368. __u64 sesid, \
  369. int rc), \
  370. TP_ARGS(xid, tid, sesid, rc))
  371. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(query_info_compound_err);
  372. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(posix_query_info_compound_err);
  373. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(hardlink_err);
  374. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rename_err);
  375. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(rmdir_err);
  376. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_eof_err);
  377. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(set_info_compound_err);
  378. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(mkdir_err);
  379. DEFINE_SMB3_INF_COMPOUND_ERR_EVENT(delete_err);
  380. /*
  381. * For logging SMB3 Status code and Command for responses which return errors
  382. */
  383. DECLARE_EVENT_CLASS(smb3_cmd_err_class,
  384. TP_PROTO(__u32 tid,
  385. __u64 sesid,
  386. __u16 cmd,
  387. __u64 mid,
  388. __u32 status,
  389. int rc),
  390. TP_ARGS(tid, sesid, cmd, mid, status, rc),
  391. TP_STRUCT__entry(
  392. __field(__u32, tid)
  393. __field(__u64, sesid)
  394. __field(__u16, cmd)
  395. __field(__u64, mid)
  396. __field(__u32, status)
  397. __field(int, rc)
  398. ),
  399. TP_fast_assign(
  400. __entry->tid = tid;
  401. __entry->sesid = sesid;
  402. __entry->cmd = cmd;
  403. __entry->mid = mid;
  404. __entry->status = status;
  405. __entry->rc = rc;
  406. ),
  407. TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
  408. __entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
  409. __entry->status, __entry->rc)
  410. )
  411. #define DEFINE_SMB3_CMD_ERR_EVENT(name) \
  412. DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \
  413. TP_PROTO(__u32 tid, \
  414. __u64 sesid, \
  415. __u16 cmd, \
  416. __u64 mid, \
  417. __u32 status, \
  418. int rc), \
  419. TP_ARGS(tid, sesid, cmd, mid, status, rc))
  420. DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
  421. DECLARE_EVENT_CLASS(smb3_cmd_done_class,
  422. TP_PROTO(__u32 tid,
  423. __u64 sesid,
  424. __u16 cmd,
  425. __u64 mid),
  426. TP_ARGS(tid, sesid, cmd, mid),
  427. TP_STRUCT__entry(
  428. __field(__u32, tid)
  429. __field(__u64, sesid)
  430. __field(__u16, cmd)
  431. __field(__u64, mid)
  432. ),
  433. TP_fast_assign(
  434. __entry->tid = tid;
  435. __entry->sesid = sesid;
  436. __entry->cmd = cmd;
  437. __entry->mid = mid;
  438. ),
  439. TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
  440. __entry->sesid, __entry->tid,
  441. __entry->cmd, __entry->mid)
  442. )
  443. #define DEFINE_SMB3_CMD_DONE_EVENT(name) \
  444. DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \
  445. TP_PROTO(__u32 tid, \
  446. __u64 sesid, \
  447. __u16 cmd, \
  448. __u64 mid), \
  449. TP_ARGS(tid, sesid, cmd, mid))
  450. DEFINE_SMB3_CMD_DONE_EVENT(cmd_enter);
  451. DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
  452. DEFINE_SMB3_CMD_DONE_EVENT(ses_expired);
  453. DECLARE_EVENT_CLASS(smb3_mid_class,
  454. TP_PROTO(__u16 cmd,
  455. __u64 mid,
  456. __u32 pid,
  457. unsigned long when_sent,
  458. unsigned long when_received),
  459. TP_ARGS(cmd, mid, pid, when_sent, when_received),
  460. TP_STRUCT__entry(
  461. __field(__u16, cmd)
  462. __field(__u64, mid)
  463. __field(__u32, pid)
  464. __field(unsigned long, when_sent)
  465. __field(unsigned long, when_received)
  466. ),
  467. TP_fast_assign(
  468. __entry->cmd = cmd;
  469. __entry->mid = mid;
  470. __entry->pid = pid;
  471. __entry->when_sent = when_sent;
  472. __entry->when_received = when_received;
  473. ),
  474. TP_printk("\tcmd=%u mid=%llu pid=%u, when_sent=%lu when_rcv=%lu",
  475. __entry->cmd, __entry->mid, __entry->pid, __entry->when_sent,
  476. __entry->when_received)
  477. )
  478. #define DEFINE_SMB3_MID_EVENT(name) \
  479. DEFINE_EVENT(smb3_mid_class, smb3_##name, \
  480. TP_PROTO(__u16 cmd, \
  481. __u64 mid, \
  482. __u32 pid, \
  483. unsigned long when_sent, \
  484. unsigned long when_received), \
  485. TP_ARGS(cmd, mid, pid, when_sent, when_received))
  486. DEFINE_SMB3_MID_EVENT(slow_rsp);
  487. DECLARE_EVENT_CLASS(smb3_exit_err_class,
  488. TP_PROTO(unsigned int xid,
  489. const char *func_name,
  490. int rc),
  491. TP_ARGS(xid, func_name, rc),
  492. TP_STRUCT__entry(
  493. __field(unsigned int, xid)
  494. __string(func_name, func_name)
  495. __field(int, rc)
  496. ),
  497. TP_fast_assign(
  498. __entry->xid = xid;
  499. __assign_str(func_name, func_name);
  500. __entry->rc = rc;
  501. ),
  502. TP_printk("\t%s: xid=%u rc=%d",
  503. __get_str(func_name), __entry->xid, __entry->rc)
  504. )
  505. #define DEFINE_SMB3_EXIT_ERR_EVENT(name) \
  506. DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \
  507. TP_PROTO(unsigned int xid, \
  508. const char *func_name, \
  509. int rc), \
  510. TP_ARGS(xid, func_name, rc))
  511. DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
  512. DECLARE_EVENT_CLASS(smb3_sync_err_class,
  513. TP_PROTO(unsigned long ino,
  514. int rc),
  515. TP_ARGS(ino, rc),
  516. TP_STRUCT__entry(
  517. __field(unsigned long, ino)
  518. __field(int, rc)
  519. ),
  520. TP_fast_assign(
  521. __entry->ino = ino;
  522. __entry->rc = rc;
  523. ),
  524. TP_printk("\tino=%lu rc=%d",
  525. __entry->ino, __entry->rc)
  526. )
  527. #define DEFINE_SMB3_SYNC_ERR_EVENT(name) \
  528. DEFINE_EVENT(smb3_sync_err_class, cifs_##name, \
  529. TP_PROTO(unsigned long ino, \
  530. int rc), \
  531. TP_ARGS(ino, rc))
  532. DEFINE_SMB3_SYNC_ERR_EVENT(fsync_err);
  533. DEFINE_SMB3_SYNC_ERR_EVENT(flush_err);
  534. DECLARE_EVENT_CLASS(smb3_enter_exit_class,
  535. TP_PROTO(unsigned int xid,
  536. const char *func_name),
  537. TP_ARGS(xid, func_name),
  538. TP_STRUCT__entry(
  539. __field(unsigned int, xid)
  540. __string(func_name, func_name)
  541. ),
  542. TP_fast_assign(
  543. __entry->xid = xid;
  544. __assign_str(func_name, func_name);
  545. ),
  546. TP_printk("\t%s: xid=%u",
  547. __get_str(func_name), __entry->xid)
  548. )
  549. #define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \
  550. DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \
  551. TP_PROTO(unsigned int xid, \
  552. const char *func_name), \
  553. TP_ARGS(xid, func_name))
  554. DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
  555. DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
  556. /*
  557. * For SMB2/SMB3 tree connect
  558. */
  559. DECLARE_EVENT_CLASS(smb3_tcon_class,
  560. TP_PROTO(unsigned int xid,
  561. __u32 tid,
  562. __u64 sesid,
  563. const char *unc_name,
  564. int rc),
  565. TP_ARGS(xid, tid, sesid, unc_name, rc),
  566. TP_STRUCT__entry(
  567. __field(unsigned int, xid)
  568. __field(__u32, tid)
  569. __field(__u64, sesid)
  570. __string(name, unc_name)
  571. __field(int, rc)
  572. ),
  573. TP_fast_assign(
  574. __entry->xid = xid;
  575. __entry->tid = tid;
  576. __entry->sesid = sesid;
  577. __assign_str(name, unc_name);
  578. __entry->rc = rc;
  579. ),
  580. TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d",
  581. __entry->xid, __entry->sesid, __entry->tid,
  582. __get_str(name), __entry->rc)
  583. )
  584. #define DEFINE_SMB3_TCON_EVENT(name) \
  585. DEFINE_EVENT(smb3_tcon_class, smb3_##name, \
  586. TP_PROTO(unsigned int xid, \
  587. __u32 tid, \
  588. __u64 sesid, \
  589. const char *unc_name, \
  590. int rc), \
  591. TP_ARGS(xid, tid, sesid, unc_name, rc))
  592. DEFINE_SMB3_TCON_EVENT(tcon);
  593. /*
  594. * For smb2/smb3 open (including create and mkdir) calls
  595. */
  596. DECLARE_EVENT_CLASS(smb3_open_enter_class,
  597. TP_PROTO(unsigned int xid,
  598. __u32 tid,
  599. __u64 sesid,
  600. int create_options,
  601. int desired_access),
  602. TP_ARGS(xid, tid, sesid, create_options, desired_access),
  603. TP_STRUCT__entry(
  604. __field(unsigned int, xid)
  605. __field(__u32, tid)
  606. __field(__u64, sesid)
  607. __field(int, create_options)
  608. __field(int, desired_access)
  609. ),
  610. TP_fast_assign(
  611. __entry->xid = xid;
  612. __entry->tid = tid;
  613. __entry->sesid = sesid;
  614. __entry->create_options = create_options;
  615. __entry->desired_access = desired_access;
  616. ),
  617. TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x",
  618. __entry->xid, __entry->sesid, __entry->tid,
  619. __entry->create_options, __entry->desired_access)
  620. )
  621. #define DEFINE_SMB3_OPEN_ENTER_EVENT(name) \
  622. DEFINE_EVENT(smb3_open_enter_class, smb3_##name, \
  623. TP_PROTO(unsigned int xid, \
  624. __u32 tid, \
  625. __u64 sesid, \
  626. int create_options, \
  627. int desired_access), \
  628. TP_ARGS(xid, tid, sesid, create_options, desired_access))
  629. DEFINE_SMB3_OPEN_ENTER_EVENT(open_enter);
  630. DEFINE_SMB3_OPEN_ENTER_EVENT(posix_mkdir_enter);
  631. DECLARE_EVENT_CLASS(smb3_open_err_class,
  632. TP_PROTO(unsigned int xid,
  633. __u32 tid,
  634. __u64 sesid,
  635. int create_options,
  636. int desired_access,
  637. int rc),
  638. TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
  639. TP_STRUCT__entry(
  640. __field(unsigned int, xid)
  641. __field(__u32, tid)
  642. __field(__u64, sesid)
  643. __field(int, create_options)
  644. __field(int, desired_access)
  645. __field(int, rc)
  646. ),
  647. TP_fast_assign(
  648. __entry->xid = xid;
  649. __entry->tid = tid;
  650. __entry->sesid = sesid;
  651. __entry->create_options = create_options;
  652. __entry->desired_access = desired_access;
  653. __entry->rc = rc;
  654. ),
  655. TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
  656. __entry->xid, __entry->sesid, __entry->tid,
  657. __entry->create_options, __entry->desired_access, __entry->rc)
  658. )
  659. #define DEFINE_SMB3_OPEN_ERR_EVENT(name) \
  660. DEFINE_EVENT(smb3_open_err_class, smb3_##name, \
  661. TP_PROTO(unsigned int xid, \
  662. __u32 tid, \
  663. __u64 sesid, \
  664. int create_options, \
  665. int desired_access, \
  666. int rc), \
  667. TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
  668. DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
  669. DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
  670. DECLARE_EVENT_CLASS(smb3_open_done_class,
  671. TP_PROTO(unsigned int xid,
  672. __u64 fid,
  673. __u32 tid,
  674. __u64 sesid,
  675. int create_options,
  676. int desired_access),
  677. TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
  678. TP_STRUCT__entry(
  679. __field(unsigned int, xid)
  680. __field(__u64, fid)
  681. __field(__u32, tid)
  682. __field(__u64, sesid)
  683. __field(int, create_options)
  684. __field(int, desired_access)
  685. ),
  686. TP_fast_assign(
  687. __entry->xid = xid;
  688. __entry->fid = fid;
  689. __entry->tid = tid;
  690. __entry->sesid = sesid;
  691. __entry->create_options = create_options;
  692. __entry->desired_access = desired_access;
  693. ),
  694. TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
  695. __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
  696. __entry->create_options, __entry->desired_access)
  697. )
  698. #define DEFINE_SMB3_OPEN_DONE_EVENT(name) \
  699. DEFINE_EVENT(smb3_open_done_class, smb3_##name, \
  700. TP_PROTO(unsigned int xid, \
  701. __u64 fid, \
  702. __u32 tid, \
  703. __u64 sesid, \
  704. int create_options, \
  705. int desired_access), \
  706. TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
  707. DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
  708. DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
  709. DECLARE_EVENT_CLASS(smb3_lease_done_class,
  710. TP_PROTO(__u32 lease_state,
  711. __u32 tid,
  712. __u64 sesid,
  713. __u64 lease_key_low,
  714. __u64 lease_key_high),
  715. TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high),
  716. TP_STRUCT__entry(
  717. __field(__u32, lease_state)
  718. __field(__u32, tid)
  719. __field(__u64, sesid)
  720. __field(__u64, lease_key_low)
  721. __field(__u64, lease_key_high)
  722. ),
  723. TP_fast_assign(
  724. __entry->lease_state = lease_state;
  725. __entry->tid = tid;
  726. __entry->sesid = sesid;
  727. __entry->lease_key_low = lease_key_low;
  728. __entry->lease_key_high = lease_key_high;
  729. ),
  730. TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x",
  731. __entry->sesid, __entry->tid, __entry->lease_key_high,
  732. __entry->lease_key_low, __entry->lease_state)
  733. )
  734. #define DEFINE_SMB3_LEASE_DONE_EVENT(name) \
  735. DEFINE_EVENT(smb3_lease_done_class, smb3_##name, \
  736. TP_PROTO(__u32 lease_state, \
  737. __u32 tid, \
  738. __u64 sesid, \
  739. __u64 lease_key_low, \
  740. __u64 lease_key_high), \
  741. TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high))
  742. DEFINE_SMB3_LEASE_DONE_EVENT(lease_done);
  743. DECLARE_EVENT_CLASS(smb3_lease_err_class,
  744. TP_PROTO(__u32 lease_state,
  745. __u32 tid,
  746. __u64 sesid,
  747. __u64 lease_key_low,
  748. __u64 lease_key_high,
  749. int rc),
  750. TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc),
  751. TP_STRUCT__entry(
  752. __field(__u32, lease_state)
  753. __field(__u32, tid)
  754. __field(__u64, sesid)
  755. __field(__u64, lease_key_low)
  756. __field(__u64, lease_key_high)
  757. __field(int, rc)
  758. ),
  759. TP_fast_assign(
  760. __entry->lease_state = lease_state;
  761. __entry->tid = tid;
  762. __entry->sesid = sesid;
  763. __entry->lease_key_low = lease_key_low;
  764. __entry->lease_key_high = lease_key_high;
  765. __entry->rc = rc;
  766. ),
  767. TP_printk("sid=0x%llx tid=0x%x lease_key=0x%llx%llx lease_state=0x%x rc=%d",
  768. __entry->sesid, __entry->tid, __entry->lease_key_high,
  769. __entry->lease_key_low, __entry->lease_state, __entry->rc)
  770. )
  771. #define DEFINE_SMB3_LEASE_ERR_EVENT(name) \
  772. DEFINE_EVENT(smb3_lease_err_class, smb3_##name, \
  773. TP_PROTO(__u32 lease_state, \
  774. __u32 tid, \
  775. __u64 sesid, \
  776. __u64 lease_key_low, \
  777. __u64 lease_key_high, \
  778. int rc), \
  779. TP_ARGS(lease_state, tid, sesid, lease_key_low, lease_key_high, rc))
  780. DEFINE_SMB3_LEASE_ERR_EVENT(lease_err);
  781. DECLARE_EVENT_CLASS(smb3_reconnect_class,
  782. TP_PROTO(__u64 currmid,
  783. __u64 conn_id,
  784. char *hostname),
  785. TP_ARGS(currmid, conn_id, hostname),
  786. TP_STRUCT__entry(
  787. __field(__u64, currmid)
  788. __field(__u64, conn_id)
  789. __string(hostname, hostname)
  790. ),
  791. TP_fast_assign(
  792. __entry->currmid = currmid;
  793. __entry->conn_id = conn_id;
  794. __assign_str(hostname, hostname);
  795. ),
  796. TP_printk("conn_id=0x%llx server=%s current_mid=%llu",
  797. __entry->conn_id,
  798. __get_str(hostname),
  799. __entry->currmid)
  800. )
  801. #define DEFINE_SMB3_RECONNECT_EVENT(name) \
  802. DEFINE_EVENT(smb3_reconnect_class, smb3_##name, \
  803. TP_PROTO(__u64 currmid, \
  804. __u64 conn_id, \
  805. char *hostname), \
  806. TP_ARGS(currmid, conn_id, hostname))
  807. DEFINE_SMB3_RECONNECT_EVENT(reconnect);
  808. DEFINE_SMB3_RECONNECT_EVENT(partial_send_reconnect);
  809. DECLARE_EVENT_CLASS(smb3_credit_class,
  810. TP_PROTO(__u64 currmid,
  811. __u64 conn_id,
  812. char *hostname,
  813. int credits,
  814. int credits_to_add,
  815. int in_flight),
  816. TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight),
  817. TP_STRUCT__entry(
  818. __field(__u64, currmid)
  819. __field(__u64, conn_id)
  820. __string(hostname, hostname)
  821. __field(int, credits)
  822. __field(int, credits_to_add)
  823. __field(int, in_flight)
  824. ),
  825. TP_fast_assign(
  826. __entry->currmid = currmid;
  827. __entry->conn_id = conn_id;
  828. __assign_str(hostname, hostname);
  829. __entry->credits = credits;
  830. __entry->credits_to_add = credits_to_add;
  831. __entry->in_flight = in_flight;
  832. ),
  833. TP_printk("conn_id=0x%llx server=%s current_mid=%llu "
  834. "credits=%d credit_change=%d in_flight=%d",
  835. __entry->conn_id,
  836. __get_str(hostname),
  837. __entry->currmid,
  838. __entry->credits,
  839. __entry->credits_to_add,
  840. __entry->in_flight)
  841. )
  842. #define DEFINE_SMB3_CREDIT_EVENT(name) \
  843. DEFINE_EVENT(smb3_credit_class, smb3_##name, \
  844. TP_PROTO(__u64 currmid, \
  845. __u64 conn_id, \
  846. char *hostname, \
  847. int credits, \
  848. int credits_to_add, \
  849. int in_flight), \
  850. TP_ARGS(currmid, conn_id, hostname, credits, credits_to_add, in_flight))
  851. DEFINE_SMB3_CREDIT_EVENT(reconnect_with_invalid_credits);
  852. DEFINE_SMB3_CREDIT_EVENT(reconnect_detected);
  853. DEFINE_SMB3_CREDIT_EVENT(credit_timeout);
  854. DEFINE_SMB3_CREDIT_EVENT(insufficient_credits);
  855. DEFINE_SMB3_CREDIT_EVENT(too_many_credits);
  856. DEFINE_SMB3_CREDIT_EVENT(add_credits);
  857. DEFINE_SMB3_CREDIT_EVENT(set_credits);
  858. #endif /* _CIFS_TRACE_H */
  859. #undef TRACE_INCLUDE_PATH
  860. #define TRACE_INCLUDE_PATH .
  861. #define TRACE_INCLUDE_FILE trace
  862. #include <trace/define_trace.h>