xref: /linux/include/trace/events/jbd2.h (revision 9fff24aa2c5c504aadead1ff9599e813604c2e53)
1d0b6e04aSLi Zefan #undef TRACE_SYSTEM
2d0b6e04aSLi Zefan #define TRACE_SYSTEM jbd2
3d0b6e04aSLi Zefan 
4879c5e6bSTheodore Ts'o #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
5879c5e6bSTheodore Ts'o #define _TRACE_JBD2_H
6879c5e6bSTheodore Ts'o 
7879c5e6bSTheodore Ts'o #include <linux/jbd2.h>
8879c5e6bSTheodore Ts'o #include <linux/tracepoint.h>
9879c5e6bSTheodore Ts'o 
10bf699327STheodore Ts'o struct transaction_chp_stats_s;
11bf699327STheodore Ts'o struct transaction_run_stats_s;
12bf699327STheodore Ts'o 
13879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_checkpoint,
14879c5e6bSTheodore Ts'o 
15879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, int result),
16879c5e6bSTheodore Ts'o 
17879c5e6bSTheodore Ts'o 	TP_ARGS(journal, result),
18879c5e6bSTheodore Ts'o 
19879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
200562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
21879c5e6bSTheodore Ts'o 		__field(	int,	result			)
22879c5e6bSTheodore Ts'o 	),
23879c5e6bSTheodore Ts'o 
24879c5e6bSTheodore Ts'o 	TP_fast_assign(
250562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
26879c5e6bSTheodore Ts'o 		__entry->result		= result;
27879c5e6bSTheodore Ts'o 	),
28879c5e6bSTheodore Ts'o 
294862fd60STheodore Ts'o 	TP_printk("dev %d,%d result %d",
304862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
31879c5e6bSTheodore Ts'o );
32879c5e6bSTheodore Ts'o 
33071688f3SLi Zefan DECLARE_EVENT_CLASS(jbd2_commit,
34879c5e6bSTheodore Ts'o 
35879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
36879c5e6bSTheodore Ts'o 
37879c5e6bSTheodore Ts'o 	TP_ARGS(journal, commit_transaction),
38879c5e6bSTheodore Ts'o 
39879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
400562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
41879c5e6bSTheodore Ts'o 		__field(	char,	sync_commit		  )
42879c5e6bSTheodore Ts'o 		__field(	int,	transaction		  )
43879c5e6bSTheodore Ts'o 	),
44879c5e6bSTheodore Ts'o 
45879c5e6bSTheodore Ts'o 	TP_fast_assign(
460562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
47879c5e6bSTheodore Ts'o 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
48879c5e6bSTheodore Ts'o 		__entry->transaction	= commit_transaction->t_tid;
49879c5e6bSTheodore Ts'o 	),
50879c5e6bSTheodore Ts'o 
514862fd60STheodore Ts'o 	TP_printk("dev %d,%d transaction %d sync %d",
524862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
534862fd60STheodore Ts'o 		  __entry->transaction, __entry->sync_commit)
54879c5e6bSTheodore Ts'o );
55879c5e6bSTheodore Ts'o 
56071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
57879c5e6bSTheodore Ts'o 
58879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
59879c5e6bSTheodore Ts'o 
60071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
61879c5e6bSTheodore Ts'o );
62879c5e6bSTheodore Ts'o 
63071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
64879c5e6bSTheodore Ts'o 
65879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
66879c5e6bSTheodore Ts'o 
67071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
68879c5e6bSTheodore Ts'o );
69879c5e6bSTheodore Ts'o 
70071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
71879c5e6bSTheodore Ts'o 
72879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
73879c5e6bSTheodore Ts'o 
74071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
75071688f3SLi Zefan );
76879c5e6bSTheodore Ts'o 
77071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
78879c5e6bSTheodore Ts'o 
79071688f3SLi Zefan 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
80879c5e6bSTheodore Ts'o 
81071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
82879c5e6bSTheodore Ts'o );
83879c5e6bSTheodore Ts'o 
842201c590SSeiji Aguchi DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
852201c590SSeiji Aguchi 
862201c590SSeiji Aguchi 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
872201c590SSeiji Aguchi 
882201c590SSeiji Aguchi 	TP_ARGS(journal, commit_transaction)
892201c590SSeiji Aguchi );
902201c590SSeiji Aguchi 
91879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_end_commit,
92879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
93879c5e6bSTheodore Ts'o 
94879c5e6bSTheodore Ts'o 	TP_ARGS(journal, commit_transaction),
95879c5e6bSTheodore Ts'o 
96879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
970562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
98879c5e6bSTheodore Ts'o 		__field(	char,	sync_commit		  )
99879c5e6bSTheodore Ts'o 		__field(	int,	transaction		  )
100879c5e6bSTheodore Ts'o 		__field(	int,	head		  	  )
101879c5e6bSTheodore Ts'o 	),
102879c5e6bSTheodore Ts'o 
103879c5e6bSTheodore Ts'o 	TP_fast_assign(
1040562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
105879c5e6bSTheodore Ts'o 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
106879c5e6bSTheodore Ts'o 		__entry->transaction	= commit_transaction->t_tid;
107879c5e6bSTheodore Ts'o 		__entry->head		= journal->j_tail_sequence;
108879c5e6bSTheodore Ts'o 	),
109879c5e6bSTheodore Ts'o 
1104862fd60STheodore Ts'o 	TP_printk("dev %d,%d transaction %d sync %d head %d",
1114862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1124862fd60STheodore Ts'o 		  __entry->transaction, __entry->sync_commit, __entry->head)
113879c5e6bSTheodore Ts'o );
114879c5e6bSTheodore Ts'o 
115879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_submit_inode_data,
116879c5e6bSTheodore Ts'o 	TP_PROTO(struct inode *inode),
117879c5e6bSTheodore Ts'o 
118879c5e6bSTheodore Ts'o 	TP_ARGS(inode),
119879c5e6bSTheodore Ts'o 
120879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
1210562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
122879c5e6bSTheodore Ts'o 		__field(	ino_t,	ino			)
123879c5e6bSTheodore Ts'o 	),
124879c5e6bSTheodore Ts'o 
125879c5e6bSTheodore Ts'o 	TP_fast_assign(
1260562e0baSJiaying Zhang 		__entry->dev	= inode->i_sb->s_dev;
127879c5e6bSTheodore Ts'o 		__entry->ino	= inode->i_ino;
128879c5e6bSTheodore Ts'o 	),
129879c5e6bSTheodore Ts'o 
1304862fd60STheodore Ts'o 	TP_printk("dev %d,%d ino %lu",
1314862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1324862fd60STheodore Ts'o 		  (unsigned long) __entry->ino)
133879c5e6bSTheodore Ts'o );
134879c5e6bSTheodore Ts'o 
135bf699327STheodore Ts'o TRACE_EVENT(jbd2_run_stats,
136bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
137bf699327STheodore Ts'o 		 struct transaction_run_stats_s *stats),
138bf699327STheodore Ts'o 
139bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
140bf699327STheodore Ts'o 
141bf699327STheodore Ts'o 	TP_STRUCT__entry(
1420562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
143bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
144bf699327STheodore Ts'o 		__field(	unsigned long,	wait		)
145*9fff24aaSTheodore Ts'o 		__field(	unsigned long,	request_delay	)
146bf699327STheodore Ts'o 		__field(	unsigned long,	running		)
147bf699327STheodore Ts'o 		__field(	unsigned long,	locked		)
148bf699327STheodore Ts'o 		__field(	unsigned long,	flushing	)
149bf699327STheodore Ts'o 		__field(	unsigned long,	logging		)
150bf699327STheodore Ts'o 		__field(		__u32,	handle_count	)
151bf699327STheodore Ts'o 		__field(		__u32,	blocks		)
152bf699327STheodore Ts'o 		__field(		__u32,	blocks_logged	)
153bf699327STheodore Ts'o 	),
154bf699327STheodore Ts'o 
155bf699327STheodore Ts'o 	TP_fast_assign(
1560562e0baSJiaying Zhang 		__entry->dev		= dev;
157bf699327STheodore Ts'o 		__entry->tid		= tid;
158bf699327STheodore Ts'o 		__entry->wait		= stats->rs_wait;
159*9fff24aaSTheodore Ts'o 		__entry->request_delay	= stats->rs_request_delay;
160bf699327STheodore Ts'o 		__entry->running	= stats->rs_running;
161bf699327STheodore Ts'o 		__entry->locked		= stats->rs_locked;
162bf699327STheodore Ts'o 		__entry->flushing	= stats->rs_flushing;
163bf699327STheodore Ts'o 		__entry->logging	= stats->rs_logging;
164bf699327STheodore Ts'o 		__entry->handle_count	= stats->rs_handle_count;
165bf699327STheodore Ts'o 		__entry->blocks		= stats->rs_blocks;
166bf699327STheodore Ts'o 		__entry->blocks_logged	= stats->rs_blocks_logged;
167bf699327STheodore Ts'o 	),
168bf699327STheodore Ts'o 
169*9fff24aaSTheodore Ts'o 	TP_printk("dev %d,%d tid %lu wait %u request_delay %u running %u "
170*9fff24aaSTheodore Ts'o 		  "locked %u flushing %u logging %u handle_count %u "
171*9fff24aaSTheodore Ts'o 		  "blocks %u blocks_logged %u",
1724862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
173bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->wait),
174*9fff24aaSTheodore Ts'o 		  jiffies_to_msecs(__entry->request_delay),
175bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->running),
176bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->locked),
177bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->flushing),
178bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->logging),
179bf699327STheodore Ts'o 		  __entry->handle_count, __entry->blocks,
180bf699327STheodore Ts'o 		  __entry->blocks_logged)
181bf699327STheodore Ts'o );
182bf699327STheodore Ts'o 
183bf699327STheodore Ts'o TRACE_EVENT(jbd2_checkpoint_stats,
184bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
185bf699327STheodore Ts'o 		 struct transaction_chp_stats_s *stats),
186bf699327STheodore Ts'o 
187bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
188bf699327STheodore Ts'o 
189bf699327STheodore Ts'o 	TP_STRUCT__entry(
1900562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
191bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
192bf699327STheodore Ts'o 		__field(	unsigned long,	chp_time	)
193bf699327STheodore Ts'o 		__field(		__u32,	forced_to_close	)
194bf699327STheodore Ts'o 		__field(		__u32,	written		)
195bf699327STheodore Ts'o 		__field(		__u32,	dropped		)
196bf699327STheodore Ts'o 	),
197bf699327STheodore Ts'o 
198bf699327STheodore Ts'o 	TP_fast_assign(
1990562e0baSJiaying Zhang 		__entry->dev		= dev;
200bf699327STheodore Ts'o 		__entry->tid		= tid;
201bf699327STheodore Ts'o 		__entry->chp_time	= stats->cs_chp_time;
202bf699327STheodore Ts'o 		__entry->forced_to_close= stats->cs_forced_to_close;
203bf699327STheodore Ts'o 		__entry->written	= stats->cs_written;
204bf699327STheodore Ts'o 		__entry->dropped	= stats->cs_dropped;
205bf699327STheodore Ts'o 	),
206bf699327STheodore Ts'o 
2074862fd60STheodore Ts'o 	TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
208bf699327STheodore Ts'o 		  "written %u dropped %u",
2094862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
210bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->chp_time),
211bf699327STheodore Ts'o 		  __entry->forced_to_close, __entry->written, __entry->dropped)
212bf699327STheodore Ts'o );
213bf699327STheodore Ts'o 
21479feb521SJan Kara TRACE_EVENT(jbd2_update_log_tail,
21571f2be21STheodore Ts'o 
21671f2be21STheodore Ts'o 	TP_PROTO(journal_t *journal, tid_t first_tid,
21771f2be21STheodore Ts'o 		 unsigned long block_nr, unsigned long freed),
21871f2be21STheodore Ts'o 
21971f2be21STheodore Ts'o 	TP_ARGS(journal, first_tid, block_nr, freed),
22071f2be21STheodore Ts'o 
22171f2be21STheodore Ts'o 	TP_STRUCT__entry(
2220562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
22371f2be21STheodore Ts'o 		__field(	tid_t,	tail_sequence		)
22471f2be21STheodore Ts'o 		__field(	tid_t,	first_tid		)
22571f2be21STheodore Ts'o 		__field(unsigned long,	block_nr		)
22671f2be21STheodore Ts'o 		__field(unsigned long,	freed			)
22771f2be21STheodore Ts'o 	),
22871f2be21STheodore Ts'o 
22971f2be21STheodore Ts'o 	TP_fast_assign(
2300562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
23171f2be21STheodore Ts'o 		__entry->tail_sequence	= journal->j_tail_sequence;
23271f2be21STheodore Ts'o 		__entry->first_tid	= first_tid;
23371f2be21STheodore Ts'o 		__entry->block_nr	= block_nr;
23471f2be21STheodore Ts'o 		__entry->freed		= freed;
23571f2be21STheodore Ts'o 	),
23671f2be21STheodore Ts'o 
2374862fd60STheodore Ts'o 	TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
2384862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2394862fd60STheodore Ts'o 		  __entry->tail_sequence, __entry->first_tid,
2404862fd60STheodore Ts'o 		  __entry->block_nr, __entry->freed)
24171f2be21STheodore Ts'o );
24271f2be21STheodore Ts'o 
24324bcc89cSJan Kara TRACE_EVENT(jbd2_write_superblock,
2442201c590SSeiji Aguchi 
24579feb521SJan Kara 	TP_PROTO(journal_t *journal, int write_op),
2462201c590SSeiji Aguchi 
24779feb521SJan Kara 	TP_ARGS(journal, write_op),
2482201c590SSeiji Aguchi 
2492201c590SSeiji Aguchi 	TP_STRUCT__entry(
2502201c590SSeiji Aguchi 		__field(	dev_t,  dev			)
25179feb521SJan Kara 		__field(	  int,  write_op		)
2522201c590SSeiji Aguchi 	),
2532201c590SSeiji Aguchi 
2542201c590SSeiji Aguchi 	TP_fast_assign(
2552201c590SSeiji Aguchi 		__entry->dev		= journal->j_fs_dev->bd_dev;
25679feb521SJan Kara 		__entry->write_op	= write_op;
2572201c590SSeiji Aguchi 	),
2582201c590SSeiji Aguchi 
25979feb521SJan Kara 	TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
26079feb521SJan Kara 		  MINOR(__entry->dev), __entry->write_op)
2612201c590SSeiji Aguchi );
2622201c590SSeiji Aguchi 
263879c5e6bSTheodore Ts'o #endif /* _TRACE_JBD2_H */
264879c5e6bSTheodore Ts'o 
265879c5e6bSTheodore Ts'o /* This part must be outside protection */
266879c5e6bSTheodore Ts'o #include <trace/define_trace.h>
267