jbd2.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM jbd2
  4. #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_JBD2_H
  6. #include <linux/jbd2.h>
  7. #include <linux/tracepoint.h>
  8. struct transaction_chp_stats_s;
  9. struct transaction_run_stats_s;
  10. TRACE_EVENT(jbd2_checkpoint,
  11. TP_PROTO(journal_t *journal, int result),
  12. TP_ARGS(journal, result),
  13. TP_STRUCT__entry(
  14. __field( dev_t, dev )
  15. __field( int, result )
  16. ),
  17. TP_fast_assign(
  18. __entry->dev = journal->j_fs_dev->bd_dev;
  19. __entry->result = result;
  20. ),
  21. TP_printk("dev %d,%d result %d",
  22. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
  23. );
  24. DECLARE_EVENT_CLASS(jbd2_commit,
  25. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  26. TP_ARGS(journal, commit_transaction),
  27. TP_STRUCT__entry(
  28. __field( dev_t, dev )
  29. __field( char, sync_commit )
  30. __field( int, transaction )
  31. ),
  32. TP_fast_assign(
  33. __entry->dev = journal->j_fs_dev->bd_dev;
  34. __entry->sync_commit = commit_transaction->t_synchronous_commit;
  35. __entry->transaction = commit_transaction->t_tid;
  36. ),
  37. TP_printk("dev %d,%d transaction %d sync %d",
  38. MAJOR(__entry->dev), MINOR(__entry->dev),
  39. __entry->transaction, __entry->sync_commit)
  40. );
  41. DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
  42. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  43. TP_ARGS(journal, commit_transaction)
  44. );
  45. DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
  46. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  47. TP_ARGS(journal, commit_transaction)
  48. );
  49. DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
  50. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  51. TP_ARGS(journal, commit_transaction)
  52. );
  53. DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
  54. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  55. TP_ARGS(journal, commit_transaction)
  56. );
  57. DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
  58. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  59. TP_ARGS(journal, commit_transaction)
  60. );
  61. TRACE_EVENT(jbd2_end_commit,
  62. TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
  63. TP_ARGS(journal, commit_transaction),
  64. TP_STRUCT__entry(
  65. __field( dev_t, dev )
  66. __field( char, sync_commit )
  67. __field( int, transaction )
  68. __field( int, head )
  69. ),
  70. TP_fast_assign(
  71. __entry->dev = journal->j_fs_dev->bd_dev;
  72. __entry->sync_commit = commit_transaction->t_synchronous_commit;
  73. __entry->transaction = commit_transaction->t_tid;
  74. __entry->head = journal->j_tail_sequence;
  75. ),
  76. TP_printk("dev %d,%d transaction %d sync %d head %d",
  77. MAJOR(__entry->dev), MINOR(__entry->dev),
  78. __entry->transaction, __entry->sync_commit, __entry->head)
  79. );
  80. TRACE_EVENT(jbd2_submit_inode_data,
  81. TP_PROTO(struct inode *inode),
  82. TP_ARGS(inode),
  83. TP_STRUCT__entry(
  84. __field( dev_t, dev )
  85. __field( ino_t, ino )
  86. ),
  87. TP_fast_assign(
  88. __entry->dev = inode->i_sb->s_dev;
  89. __entry->ino = inode->i_ino;
  90. ),
  91. TP_printk("dev %d,%d ino %lu",
  92. MAJOR(__entry->dev), MINOR(__entry->dev),
  93. (unsigned long) __entry->ino)
  94. );
  95. TRACE_EVENT(jbd2_handle_start,
  96. TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
  97. unsigned int line_no, int requested_blocks),
  98. TP_ARGS(dev, tid, type, line_no, requested_blocks),
  99. TP_STRUCT__entry(
  100. __field( dev_t, dev )
  101. __field( unsigned long, tid )
  102. __field( unsigned int, type )
  103. __field( unsigned int, line_no )
  104. __field( int, requested_blocks)
  105. ),
  106. TP_fast_assign(
  107. __entry->dev = dev;
  108. __entry->tid = tid;
  109. __entry->type = type;
  110. __entry->line_no = line_no;
  111. __entry->requested_blocks = requested_blocks;
  112. ),
  113. TP_printk("dev %d,%d tid %lu type %u line_no %u "
  114. "requested_blocks %d",
  115. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
  116. __entry->type, __entry->line_no, __entry->requested_blocks)
  117. );
  118. TRACE_EVENT(jbd2_handle_extend,
  119. TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
  120. unsigned int line_no, int buffer_credits,
  121. int requested_blocks),
  122. TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),
  123. TP_STRUCT__entry(
  124. __field( dev_t, dev )
  125. __field( unsigned long, tid )
  126. __field( unsigned int, type )
  127. __field( unsigned int, line_no )
  128. __field( int, buffer_credits )
  129. __field( int, requested_blocks)
  130. ),
  131. TP_fast_assign(
  132. __entry->dev = dev;
  133. __entry->tid = tid;
  134. __entry->type = type;
  135. __entry->line_no = line_no;
  136. __entry->buffer_credits = buffer_credits;
  137. __entry->requested_blocks = requested_blocks;
  138. ),
  139. TP_printk("dev %d,%d tid %lu type %u line_no %u "
  140. "buffer_credits %d requested_blocks %d",
  141. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
  142. __entry->type, __entry->line_no, __entry->buffer_credits,
  143. __entry->requested_blocks)
  144. );
  145. TRACE_EVENT(jbd2_handle_stats,
  146. TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
  147. unsigned int line_no, int interval, int sync,
  148. int requested_blocks, int dirtied_blocks),
  149. TP_ARGS(dev, tid, type, line_no, interval, sync,
  150. requested_blocks, dirtied_blocks),
  151. TP_STRUCT__entry(
  152. __field( dev_t, dev )
  153. __field( unsigned long, tid )
  154. __field( unsigned int, type )
  155. __field( unsigned int, line_no )
  156. __field( int, interval )
  157. __field( int, sync )
  158. __field( int, requested_blocks)
  159. __field( int, dirtied_blocks )
  160. ),
  161. TP_fast_assign(
  162. __entry->dev = dev;
  163. __entry->tid = tid;
  164. __entry->type = type;
  165. __entry->line_no = line_no;
  166. __entry->interval = interval;
  167. __entry->sync = sync;
  168. __entry->requested_blocks = requested_blocks;
  169. __entry->dirtied_blocks = dirtied_blocks;
  170. ),
  171. TP_printk("dev %d,%d tid %lu type %u line_no %u interval %d "
  172. "sync %d requested_blocks %d dirtied_blocks %d",
  173. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
  174. __entry->type, __entry->line_no, __entry->interval,
  175. __entry->sync, __entry->requested_blocks,
  176. __entry->dirtied_blocks)
  177. );
  178. TRACE_EVENT(jbd2_run_stats,
  179. TP_PROTO(dev_t dev, unsigned long tid,
  180. struct transaction_run_stats_s *stats),
  181. TP_ARGS(dev, tid, stats),
  182. TP_STRUCT__entry(
  183. __field( dev_t, dev )
  184. __field( unsigned long, tid )
  185. __field( unsigned long, wait )
  186. __field( unsigned long, request_delay )
  187. __field( unsigned long, running )
  188. __field( unsigned long, locked )
  189. __field( unsigned long, flushing )
  190. __field( unsigned long, logging )
  191. __field( __u32, handle_count )
  192. __field( __u32, blocks )
  193. __field( __u32, blocks_logged )
  194. ),
  195. TP_fast_assign(
  196. __entry->dev = dev;
  197. __entry->tid = tid;
  198. __entry->wait = stats->rs_wait;
  199. __entry->request_delay = stats->rs_request_delay;
  200. __entry->running = stats->rs_running;
  201. __entry->locked = stats->rs_locked;
  202. __entry->flushing = stats->rs_flushing;
  203. __entry->logging = stats->rs_logging;
  204. __entry->handle_count = stats->rs_handle_count;
  205. __entry->blocks = stats->rs_blocks;
  206. __entry->blocks_logged = stats->rs_blocks_logged;
  207. ),
  208. TP_printk("dev %d,%d tid %lu wait %u request_delay %u running %u "
  209. "locked %u flushing %u logging %u handle_count %u "
  210. "blocks %u blocks_logged %u",
  211. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
  212. jiffies_to_msecs(__entry->wait),
  213. jiffies_to_msecs(__entry->request_delay),
  214. jiffies_to_msecs(__entry->running),
  215. jiffies_to_msecs(__entry->locked),
  216. jiffies_to_msecs(__entry->flushing),
  217. jiffies_to_msecs(__entry->logging),
  218. __entry->handle_count, __entry->blocks,
  219. __entry->blocks_logged)
  220. );
  221. TRACE_EVENT(jbd2_checkpoint_stats,
  222. TP_PROTO(dev_t dev, unsigned long tid,
  223. struct transaction_chp_stats_s *stats),
  224. TP_ARGS(dev, tid, stats),
  225. TP_STRUCT__entry(
  226. __field( dev_t, dev )
  227. __field( unsigned long, tid )
  228. __field( unsigned long, chp_time )
  229. __field( __u32, forced_to_close )
  230. __field( __u32, written )
  231. __field( __u32, dropped )
  232. ),
  233. TP_fast_assign(
  234. __entry->dev = dev;
  235. __entry->tid = tid;
  236. __entry->chp_time = stats->cs_chp_time;
  237. __entry->forced_to_close= stats->cs_forced_to_close;
  238. __entry->written = stats->cs_written;
  239. __entry->dropped = stats->cs_dropped;
  240. ),
  241. TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
  242. "written %u dropped %u",
  243. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
  244. jiffies_to_msecs(__entry->chp_time),
  245. __entry->forced_to_close, __entry->written, __entry->dropped)
  246. );
  247. TRACE_EVENT(jbd2_update_log_tail,
  248. TP_PROTO(journal_t *journal, tid_t first_tid,
  249. unsigned long block_nr, unsigned long freed),
  250. TP_ARGS(journal, first_tid, block_nr, freed),
  251. TP_STRUCT__entry(
  252. __field( dev_t, dev )
  253. __field( tid_t, tail_sequence )
  254. __field( tid_t, first_tid )
  255. __field(unsigned long, block_nr )
  256. __field(unsigned long, freed )
  257. ),
  258. TP_fast_assign(
  259. __entry->dev = journal->j_fs_dev->bd_dev;
  260. __entry->tail_sequence = journal->j_tail_sequence;
  261. __entry->first_tid = first_tid;
  262. __entry->block_nr = block_nr;
  263. __entry->freed = freed;
  264. ),
  265. TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
  266. MAJOR(__entry->dev), MINOR(__entry->dev),
  267. __entry->tail_sequence, __entry->first_tid,
  268. __entry->block_nr, __entry->freed)
  269. );
  270. TRACE_EVENT(jbd2_write_superblock,
  271. TP_PROTO(journal_t *journal, int write_op),
  272. TP_ARGS(journal, write_op),
  273. TP_STRUCT__entry(
  274. __field( dev_t, dev )
  275. __field( int, write_op )
  276. ),
  277. TP_fast_assign(
  278. __entry->dev = journal->j_fs_dev->bd_dev;
  279. __entry->write_op = write_op;
  280. ),
  281. TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
  282. MINOR(__entry->dev), __entry->write_op)
  283. );
  284. TRACE_EVENT(jbd2_lock_buffer_stall,
  285. TP_PROTO(dev_t dev, unsigned long stall_ms),
  286. TP_ARGS(dev, stall_ms),
  287. TP_STRUCT__entry(
  288. __field( dev_t, dev )
  289. __field(unsigned long, stall_ms )
  290. ),
  291. TP_fast_assign(
  292. __entry->dev = dev;
  293. __entry->stall_ms = stall_ms;
  294. ),
  295. TP_printk("dev %d,%d stall_ms %lu",
  296. MAJOR(__entry->dev), MINOR(__entry->dev),
  297. __entry->stall_ms)
  298. );
  299. #endif /* _TRACE_JBD2_H */
  300. /* This part must be outside protection */
  301. #include <trace/define_trace.h>