nfstrace.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  1. /*
  2. * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
  3. */
  4. #undef TRACE_SYSTEM
  5. #define TRACE_SYSTEM nfs
  6. #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
  7. #define _TRACE_NFS_H
  8. #include <linux/tracepoint.h>
  9. #define nfs_show_file_type(ftype) \
  10. __print_symbolic(ftype, \
  11. { DT_UNKNOWN, "UNKNOWN" }, \
  12. { DT_FIFO, "FIFO" }, \
  13. { DT_CHR, "CHR" }, \
  14. { DT_DIR, "DIR" }, \
  15. { DT_BLK, "BLK" }, \
  16. { DT_REG, "REG" }, \
  17. { DT_LNK, "LNK" }, \
  18. { DT_SOCK, "SOCK" }, \
  19. { DT_WHT, "WHT" })
  20. #define nfs_show_cache_validity(v) \
  21. __print_flags(v, "|", \
  22. { NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \
  23. { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
  24. { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
  25. { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
  26. { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
  27. { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
  28. { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
  29. { NFS_INO_INVALID_LABEL, "INVALID_LABEL" })
  30. #define nfs_show_nfsi_flags(v) \
  31. __print_flags(v, "|", \
  32. { 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \
  33. { 1 << NFS_INO_STALE, "STALE" }, \
  34. { 1 << NFS_INO_INVALIDATING, "INVALIDATING" }, \
  35. { 1 << NFS_INO_FSCACHE, "FSCACHE" }, \
  36. { 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \
  37. { 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" })
  38. DECLARE_EVENT_CLASS(nfs_inode_event,
  39. TP_PROTO(
  40. const struct inode *inode
  41. ),
  42. TP_ARGS(inode),
  43. TP_STRUCT__entry(
  44. __field(dev_t, dev)
  45. __field(u32, fhandle)
  46. __field(u64, fileid)
  47. __field(u64, version)
  48. ),
  49. TP_fast_assign(
  50. const struct nfs_inode *nfsi = NFS_I(inode);
  51. __entry->dev = inode->i_sb->s_dev;
  52. __entry->fileid = nfsi->fileid;
  53. __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
  54. __entry->version = inode->i_version;
  55. ),
  56. TP_printk(
  57. "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
  58. MAJOR(__entry->dev), MINOR(__entry->dev),
  59. (unsigned long long)__entry->fileid,
  60. __entry->fhandle,
  61. (unsigned long long)__entry->version
  62. )
  63. );
  64. DECLARE_EVENT_CLASS(nfs_inode_event_done,
  65. TP_PROTO(
  66. const struct inode *inode,
  67. int error
  68. ),
  69. TP_ARGS(inode, error),
  70. TP_STRUCT__entry(
  71. __field(int, error)
  72. __field(dev_t, dev)
  73. __field(u32, fhandle)
  74. __field(unsigned char, type)
  75. __field(u64, fileid)
  76. __field(u64, version)
  77. __field(loff_t, size)
  78. __field(unsigned long, nfsi_flags)
  79. __field(unsigned long, cache_validity)
  80. ),
  81. TP_fast_assign(
  82. const struct nfs_inode *nfsi = NFS_I(inode);
  83. __entry->error = error;
  84. __entry->dev = inode->i_sb->s_dev;
  85. __entry->fileid = nfsi->fileid;
  86. __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
  87. __entry->type = nfs_umode_to_dtype(inode->i_mode);
  88. __entry->version = inode->i_version;
  89. __entry->size = i_size_read(inode);
  90. __entry->nfsi_flags = nfsi->flags;
  91. __entry->cache_validity = nfsi->cache_validity;
  92. ),
  93. TP_printk(
  94. "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
  95. "type=%u (%s) version=%llu size=%lld "
  96. "cache_validity=%lu (%s) nfs_flags=%ld (%s)",
  97. __entry->error,
  98. MAJOR(__entry->dev), MINOR(__entry->dev),
  99. (unsigned long long)__entry->fileid,
  100. __entry->fhandle,
  101. __entry->type,
  102. nfs_show_file_type(__entry->type),
  103. (unsigned long long)__entry->version,
  104. (long long)__entry->size,
  105. __entry->cache_validity,
  106. nfs_show_cache_validity(__entry->cache_validity),
  107. __entry->nfsi_flags,
  108. nfs_show_nfsi_flags(__entry->nfsi_flags)
  109. )
  110. );
  111. #define DEFINE_NFS_INODE_EVENT(name) \
  112. DEFINE_EVENT(nfs_inode_event, name, \
  113. TP_PROTO( \
  114. const struct inode *inode \
  115. ), \
  116. TP_ARGS(inode))
  117. #define DEFINE_NFS_INODE_EVENT_DONE(name) \
  118. DEFINE_EVENT(nfs_inode_event_done, name, \
  119. TP_PROTO( \
  120. const struct inode *inode, \
  121. int error \
  122. ), \
  123. TP_ARGS(inode, error))
  124. DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
  125. DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
  126. DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
  127. DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
  128. DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
  129. DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
  130. DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
  131. DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
  132. DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
  133. DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
  134. DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
  135. DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
  136. DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
  137. DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
  138. DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
  139. DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
  140. DEFINE_NFS_INODE_EVENT(nfs_access_enter);
  141. DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
  142. #define show_lookup_flags(flags) \
  143. __print_flags((unsigned long)flags, "|", \
  144. { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
  145. { LOOKUP_DIRECTORY, "DIRECTORY" }, \
  146. { LOOKUP_OPEN, "OPEN" }, \
  147. { LOOKUP_CREATE, "CREATE" }, \
  148. { LOOKUP_EXCL, "EXCL" })
  149. DECLARE_EVENT_CLASS(nfs_lookup_event,
  150. TP_PROTO(
  151. const struct inode *dir,
  152. const struct dentry *dentry,
  153. unsigned int flags
  154. ),
  155. TP_ARGS(dir, dentry, flags),
  156. TP_STRUCT__entry(
  157. __field(unsigned int, flags)
  158. __field(dev_t, dev)
  159. __field(u64, dir)
  160. __string(name, dentry->d_name.name)
  161. ),
  162. TP_fast_assign(
  163. __entry->dev = dir->i_sb->s_dev;
  164. __entry->dir = NFS_FILEID(dir);
  165. __entry->flags = flags;
  166. __assign_str(name, dentry->d_name.name);
  167. ),
  168. TP_printk(
  169. "flags=%u (%s) name=%02x:%02x:%llu/%s",
  170. __entry->flags,
  171. show_lookup_flags(__entry->flags),
  172. MAJOR(__entry->dev), MINOR(__entry->dev),
  173. (unsigned long long)__entry->dir,
  174. __get_str(name)
  175. )
  176. );
  177. #define DEFINE_NFS_LOOKUP_EVENT(name) \
  178. DEFINE_EVENT(nfs_lookup_event, name, \
  179. TP_PROTO( \
  180. const struct inode *dir, \
  181. const struct dentry *dentry, \
  182. unsigned int flags \
  183. ), \
  184. TP_ARGS(dir, dentry, flags))
  185. DECLARE_EVENT_CLASS(nfs_lookup_event_done,
  186. TP_PROTO(
  187. const struct inode *dir,
  188. const struct dentry *dentry,
  189. unsigned int flags,
  190. int error
  191. ),
  192. TP_ARGS(dir, dentry, flags, error),
  193. TP_STRUCT__entry(
  194. __field(int, error)
  195. __field(unsigned int, flags)
  196. __field(dev_t, dev)
  197. __field(u64, dir)
  198. __string(name, dentry->d_name.name)
  199. ),
  200. TP_fast_assign(
  201. __entry->dev = dir->i_sb->s_dev;
  202. __entry->dir = NFS_FILEID(dir);
  203. __entry->error = error;
  204. __entry->flags = flags;
  205. __assign_str(name, dentry->d_name.name);
  206. ),
  207. TP_printk(
  208. "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
  209. __entry->error,
  210. __entry->flags,
  211. show_lookup_flags(__entry->flags),
  212. MAJOR(__entry->dev), MINOR(__entry->dev),
  213. (unsigned long long)__entry->dir,
  214. __get_str(name)
  215. )
  216. );
  217. #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
  218. DEFINE_EVENT(nfs_lookup_event_done, name, \
  219. TP_PROTO( \
  220. const struct inode *dir, \
  221. const struct dentry *dentry, \
  222. unsigned int flags, \
  223. int error \
  224. ), \
  225. TP_ARGS(dir, dentry, flags, error))
  226. DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
  227. DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
  228. DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
  229. DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
  230. #define show_open_flags(flags) \
  231. __print_flags((unsigned long)flags, "|", \
  232. { O_CREAT, "O_CREAT" }, \
  233. { O_EXCL, "O_EXCL" }, \
  234. { O_TRUNC, "O_TRUNC" }, \
  235. { O_APPEND, "O_APPEND" }, \
  236. { O_DSYNC, "O_DSYNC" }, \
  237. { O_DIRECT, "O_DIRECT" }, \
  238. { O_DIRECTORY, "O_DIRECTORY" })
  239. #define show_fmode_flags(mode) \
  240. __print_flags(mode, "|", \
  241. { ((__force unsigned long)FMODE_READ), "READ" }, \
  242. { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
  243. { ((__force unsigned long)FMODE_EXEC), "EXEC" })
  244. TRACE_EVENT(nfs_atomic_open_enter,
  245. TP_PROTO(
  246. const struct inode *dir,
  247. const struct nfs_open_context *ctx,
  248. unsigned int flags
  249. ),
  250. TP_ARGS(dir, ctx, flags),
  251. TP_STRUCT__entry(
  252. __field(unsigned int, flags)
  253. __field(unsigned int, fmode)
  254. __field(dev_t, dev)
  255. __field(u64, dir)
  256. __string(name, ctx->dentry->d_name.name)
  257. ),
  258. TP_fast_assign(
  259. __entry->dev = dir->i_sb->s_dev;
  260. __entry->dir = NFS_FILEID(dir);
  261. __entry->flags = flags;
  262. __entry->fmode = (__force unsigned int)ctx->mode;
  263. __assign_str(name, ctx->dentry->d_name.name);
  264. ),
  265. TP_printk(
  266. "flags=%u (%s) fmode=%s name=%02x:%02x:%llu/%s",
  267. __entry->flags,
  268. show_open_flags(__entry->flags),
  269. show_fmode_flags(__entry->fmode),
  270. MAJOR(__entry->dev), MINOR(__entry->dev),
  271. (unsigned long long)__entry->dir,
  272. __get_str(name)
  273. )
  274. );
  275. TRACE_EVENT(nfs_atomic_open_exit,
  276. TP_PROTO(
  277. const struct inode *dir,
  278. const struct nfs_open_context *ctx,
  279. unsigned int flags,
  280. int error
  281. ),
  282. TP_ARGS(dir, ctx, flags, error),
  283. TP_STRUCT__entry(
  284. __field(int, error)
  285. __field(unsigned int, flags)
  286. __field(unsigned int, fmode)
  287. __field(dev_t, dev)
  288. __field(u64, dir)
  289. __string(name, ctx->dentry->d_name.name)
  290. ),
  291. TP_fast_assign(
  292. __entry->error = error;
  293. __entry->dev = dir->i_sb->s_dev;
  294. __entry->dir = NFS_FILEID(dir);
  295. __entry->flags = flags;
  296. __entry->fmode = (__force unsigned int)ctx->mode;
  297. __assign_str(name, ctx->dentry->d_name.name);
  298. ),
  299. TP_printk(
  300. "error=%d flags=%u (%s) fmode=%s "
  301. "name=%02x:%02x:%llu/%s",
  302. __entry->error,
  303. __entry->flags,
  304. show_open_flags(__entry->flags),
  305. show_fmode_flags(__entry->fmode),
  306. MAJOR(__entry->dev), MINOR(__entry->dev),
  307. (unsigned long long)__entry->dir,
  308. __get_str(name)
  309. )
  310. );
  311. TRACE_EVENT(nfs_create_enter,
  312. TP_PROTO(
  313. const struct inode *dir,
  314. const struct dentry *dentry,
  315. unsigned int flags
  316. ),
  317. TP_ARGS(dir, dentry, flags),
  318. TP_STRUCT__entry(
  319. __field(unsigned int, flags)
  320. __field(dev_t, dev)
  321. __field(u64, dir)
  322. __string(name, dentry->d_name.name)
  323. ),
  324. TP_fast_assign(
  325. __entry->dev = dir->i_sb->s_dev;
  326. __entry->dir = NFS_FILEID(dir);
  327. __entry->flags = flags;
  328. __assign_str(name, dentry->d_name.name);
  329. ),
  330. TP_printk(
  331. "flags=%u (%s) name=%02x:%02x:%llu/%s",
  332. __entry->flags,
  333. show_open_flags(__entry->flags),
  334. MAJOR(__entry->dev), MINOR(__entry->dev),
  335. (unsigned long long)__entry->dir,
  336. __get_str(name)
  337. )
  338. );
  339. TRACE_EVENT(nfs_create_exit,
  340. TP_PROTO(
  341. const struct inode *dir,
  342. const struct dentry *dentry,
  343. unsigned int flags,
  344. int error
  345. ),
  346. TP_ARGS(dir, dentry, flags, error),
  347. TP_STRUCT__entry(
  348. __field(int, error)
  349. __field(unsigned int, flags)
  350. __field(dev_t, dev)
  351. __field(u64, dir)
  352. __string(name, dentry->d_name.name)
  353. ),
  354. TP_fast_assign(
  355. __entry->error = error;
  356. __entry->dev = dir->i_sb->s_dev;
  357. __entry->dir = NFS_FILEID(dir);
  358. __entry->flags = flags;
  359. __assign_str(name, dentry->d_name.name);
  360. ),
  361. TP_printk(
  362. "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
  363. __entry->error,
  364. __entry->flags,
  365. show_open_flags(__entry->flags),
  366. MAJOR(__entry->dev), MINOR(__entry->dev),
  367. (unsigned long long)__entry->dir,
  368. __get_str(name)
  369. )
  370. );
  371. DECLARE_EVENT_CLASS(nfs_directory_event,
  372. TP_PROTO(
  373. const struct inode *dir,
  374. const struct dentry *dentry
  375. ),
  376. TP_ARGS(dir, dentry),
  377. TP_STRUCT__entry(
  378. __field(dev_t, dev)
  379. __field(u64, dir)
  380. __string(name, dentry->d_name.name)
  381. ),
  382. TP_fast_assign(
  383. __entry->dev = dir->i_sb->s_dev;
  384. __entry->dir = NFS_FILEID(dir);
  385. __assign_str(name, dentry->d_name.name);
  386. ),
  387. TP_printk(
  388. "name=%02x:%02x:%llu/%s",
  389. MAJOR(__entry->dev), MINOR(__entry->dev),
  390. (unsigned long long)__entry->dir,
  391. __get_str(name)
  392. )
  393. );
  394. #define DEFINE_NFS_DIRECTORY_EVENT(name) \
  395. DEFINE_EVENT(nfs_directory_event, name, \
  396. TP_PROTO( \
  397. const struct inode *dir, \
  398. const struct dentry *dentry \
  399. ), \
  400. TP_ARGS(dir, dentry))
  401. DECLARE_EVENT_CLASS(nfs_directory_event_done,
  402. TP_PROTO(
  403. const struct inode *dir,
  404. const struct dentry *dentry,
  405. int error
  406. ),
  407. TP_ARGS(dir, dentry, error),
  408. TP_STRUCT__entry(
  409. __field(int, error)
  410. __field(dev_t, dev)
  411. __field(u64, dir)
  412. __string(name, dentry->d_name.name)
  413. ),
  414. TP_fast_assign(
  415. __entry->dev = dir->i_sb->s_dev;
  416. __entry->dir = NFS_FILEID(dir);
  417. __entry->error = error;
  418. __assign_str(name, dentry->d_name.name);
  419. ),
  420. TP_printk(
  421. "error=%d name=%02x:%02x:%llu/%s",
  422. __entry->error,
  423. MAJOR(__entry->dev), MINOR(__entry->dev),
  424. (unsigned long long)__entry->dir,
  425. __get_str(name)
  426. )
  427. );
  428. #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
  429. DEFINE_EVENT(nfs_directory_event_done, name, \
  430. TP_PROTO( \
  431. const struct inode *dir, \
  432. const struct dentry *dentry, \
  433. int error \
  434. ), \
  435. TP_ARGS(dir, dentry, error))
  436. DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
  437. DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
  438. DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
  439. DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
  440. DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
  441. DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
  442. DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
  443. DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
  444. DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
  445. DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
  446. DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
  447. DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
  448. TRACE_EVENT(nfs_link_enter,
  449. TP_PROTO(
  450. const struct inode *inode,
  451. const struct inode *dir,
  452. const struct dentry *dentry
  453. ),
  454. TP_ARGS(inode, dir, dentry),
  455. TP_STRUCT__entry(
  456. __field(dev_t, dev)
  457. __field(u64, fileid)
  458. __field(u64, dir)
  459. __string(name, dentry->d_name.name)
  460. ),
  461. TP_fast_assign(
  462. __entry->dev = inode->i_sb->s_dev;
  463. __entry->fileid = NFS_FILEID(inode);
  464. __entry->dir = NFS_FILEID(dir);
  465. __assign_str(name, dentry->d_name.name);
  466. ),
  467. TP_printk(
  468. "fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
  469. MAJOR(__entry->dev), MINOR(__entry->dev),
  470. __entry->fileid,
  471. MAJOR(__entry->dev), MINOR(__entry->dev),
  472. (unsigned long long)__entry->dir,
  473. __get_str(name)
  474. )
  475. );
  476. TRACE_EVENT(nfs_link_exit,
  477. TP_PROTO(
  478. const struct inode *inode,
  479. const struct inode *dir,
  480. const struct dentry *dentry,
  481. int error
  482. ),
  483. TP_ARGS(inode, dir, dentry, error),
  484. TP_STRUCT__entry(
  485. __field(int, error)
  486. __field(dev_t, dev)
  487. __field(u64, fileid)
  488. __field(u64, dir)
  489. __string(name, dentry->d_name.name)
  490. ),
  491. TP_fast_assign(
  492. __entry->dev = inode->i_sb->s_dev;
  493. __entry->fileid = NFS_FILEID(inode);
  494. __entry->dir = NFS_FILEID(dir);
  495. __entry->error = error;
  496. __assign_str(name, dentry->d_name.name);
  497. ),
  498. TP_printk(
  499. "error=%d fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
  500. __entry->error,
  501. MAJOR(__entry->dev), MINOR(__entry->dev),
  502. __entry->fileid,
  503. MAJOR(__entry->dev), MINOR(__entry->dev),
  504. (unsigned long long)__entry->dir,
  505. __get_str(name)
  506. )
  507. );
  508. DECLARE_EVENT_CLASS(nfs_rename_event,
  509. TP_PROTO(
  510. const struct inode *old_dir,
  511. const struct dentry *old_dentry,
  512. const struct inode *new_dir,
  513. const struct dentry *new_dentry
  514. ),
  515. TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
  516. TP_STRUCT__entry(
  517. __field(dev_t, dev)
  518. __field(u64, old_dir)
  519. __field(u64, new_dir)
  520. __string(old_name, old_dentry->d_name.name)
  521. __string(new_name, new_dentry->d_name.name)
  522. ),
  523. TP_fast_assign(
  524. __entry->dev = old_dir->i_sb->s_dev;
  525. __entry->old_dir = NFS_FILEID(old_dir);
  526. __entry->new_dir = NFS_FILEID(new_dir);
  527. __assign_str(old_name, old_dentry->d_name.name);
  528. __assign_str(new_name, new_dentry->d_name.name);
  529. ),
  530. TP_printk(
  531. "old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
  532. MAJOR(__entry->dev), MINOR(__entry->dev),
  533. (unsigned long long)__entry->old_dir,
  534. __get_str(old_name),
  535. MAJOR(__entry->dev), MINOR(__entry->dev),
  536. (unsigned long long)__entry->new_dir,
  537. __get_str(new_name)
  538. )
  539. );
  540. #define DEFINE_NFS_RENAME_EVENT(name) \
  541. DEFINE_EVENT(nfs_rename_event, name, \
  542. TP_PROTO( \
  543. const struct inode *old_dir, \
  544. const struct dentry *old_dentry, \
  545. const struct inode *new_dir, \
  546. const struct dentry *new_dentry \
  547. ), \
  548. TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
  549. DECLARE_EVENT_CLASS(nfs_rename_event_done,
  550. TP_PROTO(
  551. const struct inode *old_dir,
  552. const struct dentry *old_dentry,
  553. const struct inode *new_dir,
  554. const struct dentry *new_dentry,
  555. int error
  556. ),
  557. TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
  558. TP_STRUCT__entry(
  559. __field(dev_t, dev)
  560. __field(int, error)
  561. __field(u64, old_dir)
  562. __string(old_name, old_dentry->d_name.name)
  563. __field(u64, new_dir)
  564. __string(new_name, new_dentry->d_name.name)
  565. ),
  566. TP_fast_assign(
  567. __entry->dev = old_dir->i_sb->s_dev;
  568. __entry->old_dir = NFS_FILEID(old_dir);
  569. __entry->new_dir = NFS_FILEID(new_dir);
  570. __entry->error = error;
  571. __assign_str(old_name, old_dentry->d_name.name);
  572. __assign_str(new_name, new_dentry->d_name.name);
  573. ),
  574. TP_printk(
  575. "error=%d old_name=%02x:%02x:%llu/%s "
  576. "new_name=%02x:%02x:%llu/%s",
  577. __entry->error,
  578. MAJOR(__entry->dev), MINOR(__entry->dev),
  579. (unsigned long long)__entry->old_dir,
  580. __get_str(old_name),
  581. MAJOR(__entry->dev), MINOR(__entry->dev),
  582. (unsigned long long)__entry->new_dir,
  583. __get_str(new_name)
  584. )
  585. );
  586. #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
  587. DEFINE_EVENT(nfs_rename_event_done, name, \
  588. TP_PROTO( \
  589. const struct inode *old_dir, \
  590. const struct dentry *old_dentry, \
  591. const struct inode *new_dir, \
  592. const struct dentry *new_dentry, \
  593. int error \
  594. ), \
  595. TP_ARGS(old_dir, old_dentry, new_dir, \
  596. new_dentry, error))
  597. DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
  598. DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
  599. DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
  600. TRACE_EVENT(nfs_sillyrename_unlink,
  601. TP_PROTO(
  602. const struct nfs_unlinkdata *data,
  603. int error
  604. ),
  605. TP_ARGS(data, error),
  606. TP_STRUCT__entry(
  607. __field(dev_t, dev)
  608. __field(int, error)
  609. __field(u64, dir)
  610. __dynamic_array(char, name, data->args.name.len + 1)
  611. ),
  612. TP_fast_assign(
  613. struct inode *dir = d_inode(data->dentry->d_parent);
  614. size_t len = data->args.name.len;
  615. __entry->dev = dir->i_sb->s_dev;
  616. __entry->dir = NFS_FILEID(dir);
  617. __entry->error = error;
  618. memcpy(__get_str(name),
  619. data->args.name.name, len);
  620. __get_str(name)[len] = 0;
  621. ),
  622. TP_printk(
  623. "error=%d name=%02x:%02x:%llu/%s",
  624. __entry->error,
  625. MAJOR(__entry->dev), MINOR(__entry->dev),
  626. (unsigned long long)__entry->dir,
  627. __get_str(name)
  628. )
  629. );
  630. #endif /* _TRACE_NFS_H */
  631. #undef TRACE_INCLUDE_PATH
  632. #define TRACE_INCLUDE_PATH .
  633. #define TRACE_INCLUDE_FILE nfstrace
  634. /* This part must be outside protection */
  635. #include <trace/define_trace.h>