nilfs2.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM nilfs2
  4. #if !defined(_TRACE_NILFS2_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_NILFS2_H
  6. #include <linux/tracepoint.h>
  7. struct nilfs_sc_info;
  8. #define show_collection_stage(type) \
  9. __print_symbolic(type, \
  10. { NILFS_ST_INIT, "ST_INIT" }, \
  11. { NILFS_ST_GC, "ST_GC" }, \
  12. { NILFS_ST_FILE, "ST_FILE" }, \
  13. { NILFS_ST_IFILE, "ST_IFILE" }, \
  14. { NILFS_ST_CPFILE, "ST_CPFILE" }, \
  15. { NILFS_ST_SUFILE, "ST_SUFILE" }, \
  16. { NILFS_ST_DAT, "ST_DAT" }, \
  17. { NILFS_ST_SR, "ST_SR" }, \
  18. { NILFS_ST_DSYNC, "ST_DSYNC" }, \
  19. { NILFS_ST_DONE, "ST_DONE"})
  20. TRACE_EVENT(nilfs2_collection_stage_transition,
  21. TP_PROTO(struct nilfs_sc_info *sci),
  22. TP_ARGS(sci),
  23. TP_STRUCT__entry(
  24. __field(void *, sci)
  25. __field(int, stage)
  26. ),
  27. TP_fast_assign(
  28. __entry->sci = sci;
  29. __entry->stage = sci->sc_stage.scnt;
  30. ),
  31. TP_printk("sci = %p stage = %s",
  32. __entry->sci,
  33. show_collection_stage(__entry->stage))
  34. );
  35. #ifndef TRACE_HEADER_MULTI_READ
  36. enum nilfs2_transaction_transition_state {
  37. TRACE_NILFS2_TRANSACTION_BEGIN,
  38. TRACE_NILFS2_TRANSACTION_COMMIT,
  39. TRACE_NILFS2_TRANSACTION_ABORT,
  40. TRACE_NILFS2_TRANSACTION_TRYLOCK,
  41. TRACE_NILFS2_TRANSACTION_LOCK,
  42. TRACE_NILFS2_TRANSACTION_UNLOCK,
  43. };
  44. #endif
  45. #define show_transaction_state(type) \
  46. __print_symbolic(type, \
  47. { TRACE_NILFS2_TRANSACTION_BEGIN, "BEGIN" }, \
  48. { TRACE_NILFS2_TRANSACTION_COMMIT, "COMMIT" }, \
  49. { TRACE_NILFS2_TRANSACTION_ABORT, "ABORT" }, \
  50. { TRACE_NILFS2_TRANSACTION_TRYLOCK, "TRYLOCK" }, \
  51. { TRACE_NILFS2_TRANSACTION_LOCK, "LOCK" }, \
  52. { TRACE_NILFS2_TRANSACTION_UNLOCK, "UNLOCK" })
  53. TRACE_EVENT(nilfs2_transaction_transition,
  54. TP_PROTO(struct super_block *sb,
  55. struct nilfs_transaction_info *ti,
  56. int count,
  57. unsigned int flags,
  58. enum nilfs2_transaction_transition_state state),
  59. TP_ARGS(sb, ti, count, flags, state),
  60. TP_STRUCT__entry(
  61. __field(void *, sb)
  62. __field(void *, ti)
  63. __field(int, count)
  64. __field(unsigned int, flags)
  65. __field(int, state)
  66. ),
  67. TP_fast_assign(
  68. __entry->sb = sb;
  69. __entry->ti = ti;
  70. __entry->count = count;
  71. __entry->flags = flags;
  72. __entry->state = state;
  73. ),
  74. TP_printk("sb = %p ti = %p count = %d flags = %x state = %s",
  75. __entry->sb,
  76. __entry->ti,
  77. __entry->count,
  78. __entry->flags,
  79. show_transaction_state(__entry->state))
  80. );
  81. TRACE_EVENT(nilfs2_segment_usage_check,
  82. TP_PROTO(struct inode *sufile,
  83. __u64 segnum,
  84. unsigned long cnt),
  85. TP_ARGS(sufile, segnum, cnt),
  86. TP_STRUCT__entry(
  87. __field(struct inode *, sufile)
  88. __field(__u64, segnum)
  89. __field(unsigned long, cnt)
  90. ),
  91. TP_fast_assign(
  92. __entry->sufile = sufile;
  93. __entry->segnum = segnum;
  94. __entry->cnt = cnt;
  95. ),
  96. TP_printk("sufile = %p segnum = %llu cnt = %lu",
  97. __entry->sufile,
  98. __entry->segnum,
  99. __entry->cnt)
  100. );
  101. TRACE_EVENT(nilfs2_segment_usage_allocated,
  102. TP_PROTO(struct inode *sufile,
  103. __u64 segnum),
  104. TP_ARGS(sufile, segnum),
  105. TP_STRUCT__entry(
  106. __field(struct inode *, sufile)
  107. __field(__u64, segnum)
  108. ),
  109. TP_fast_assign(
  110. __entry->sufile = sufile;
  111. __entry->segnum = segnum;
  112. ),
  113. TP_printk("sufile = %p segnum = %llu",
  114. __entry->sufile,
  115. __entry->segnum)
  116. );
  117. TRACE_EVENT(nilfs2_segment_usage_freed,
  118. TP_PROTO(struct inode *sufile,
  119. __u64 segnum),
  120. TP_ARGS(sufile, segnum),
  121. TP_STRUCT__entry(
  122. __field(struct inode *, sufile)
  123. __field(__u64, segnum)
  124. ),
  125. TP_fast_assign(
  126. __entry->sufile = sufile;
  127. __entry->segnum = segnum;
  128. ),
  129. TP_printk("sufile = %p segnum = %llu",
  130. __entry->sufile,
  131. __entry->segnum)
  132. );
  133. TRACE_EVENT(nilfs2_mdt_insert_new_block,
  134. TP_PROTO(struct inode *inode,
  135. unsigned long ino,
  136. unsigned long block),
  137. TP_ARGS(inode, ino, block),
  138. TP_STRUCT__entry(
  139. __field(struct inode *, inode)
  140. __field(unsigned long, ino)
  141. __field(unsigned long, block)
  142. ),
  143. TP_fast_assign(
  144. __entry->inode = inode;
  145. __entry->ino = ino;
  146. __entry->block = block;
  147. ),
  148. TP_printk("inode = %p ino = %lu block = %lu",
  149. __entry->inode,
  150. __entry->ino,
  151. __entry->block)
  152. );
  153. TRACE_EVENT(nilfs2_mdt_submit_block,
  154. TP_PROTO(struct inode *inode,
  155. unsigned long ino,
  156. unsigned long blkoff,
  157. int mode),
  158. TP_ARGS(inode, ino, blkoff, mode),
  159. TP_STRUCT__entry(
  160. __field(struct inode *, inode)
  161. __field(unsigned long, ino)
  162. __field(unsigned long, blkoff)
  163. __field(int, mode)
  164. ),
  165. TP_fast_assign(
  166. __entry->inode = inode;
  167. __entry->ino = ino;
  168. __entry->blkoff = blkoff;
  169. __entry->mode = mode;
  170. ),
  171. TP_printk("inode = %p ino = %lu blkoff = %lu mode = %x",
  172. __entry->inode,
  173. __entry->ino,
  174. __entry->blkoff,
  175. __entry->mode)
  176. );
  177. #endif /* _TRACE_NILFS2_H */
  178. /* This part must be outside protection */
  179. #undef TRACE_INCLUDE_FILE
  180. #define TRACE_INCLUDE_FILE nilfs2
  181. #include <trace/define_trace.h>