xref: /linux/include/trace/events/jbd2.h (revision 24bcc89c7e7c64982e6192b4952a0a92379fc341)
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		)
145bf699327STheodore Ts'o 		__field(	unsigned long,	running		)
146bf699327STheodore Ts'o 		__field(	unsigned long,	locked		)
147bf699327STheodore Ts'o 		__field(	unsigned long,	flushing	)
148bf699327STheodore Ts'o 		__field(	unsigned long,	logging		)
149bf699327STheodore Ts'o 		__field(		__u32,	handle_count	)
150bf699327STheodore Ts'o 		__field(		__u32,	blocks		)
151bf699327STheodore Ts'o 		__field(		__u32,	blocks_logged	)
152bf699327STheodore Ts'o 	),
153bf699327STheodore Ts'o 
154bf699327STheodore Ts'o 	TP_fast_assign(
1550562e0baSJiaying Zhang 		__entry->dev		= dev;
156bf699327STheodore Ts'o 		__entry->tid		= tid;
157bf699327STheodore Ts'o 		__entry->wait		= stats->rs_wait;
158bf699327STheodore Ts'o 		__entry->running	= stats->rs_running;
159bf699327STheodore Ts'o 		__entry->locked		= stats->rs_locked;
160bf699327STheodore Ts'o 		__entry->flushing	= stats->rs_flushing;
161bf699327STheodore Ts'o 		__entry->logging	= stats->rs_logging;
162bf699327STheodore Ts'o 		__entry->handle_count	= stats->rs_handle_count;
163bf699327STheodore Ts'o 		__entry->blocks		= stats->rs_blocks;
164bf699327STheodore Ts'o 		__entry->blocks_logged	= stats->rs_blocks_logged;
165bf699327STheodore Ts'o 	),
166bf699327STheodore Ts'o 
1674862fd60STheodore Ts'o 	TP_printk("dev %d,%d tid %lu wait %u running %u locked %u flushing %u "
168bf699327STheodore Ts'o 		  "logging %u handle_count %u blocks %u blocks_logged %u",
1694862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
170bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->wait),
171bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->running),
172bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->locked),
173bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->flushing),
174bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->logging),
175bf699327STheodore Ts'o 		  __entry->handle_count, __entry->blocks,
176bf699327STheodore Ts'o 		  __entry->blocks_logged)
177bf699327STheodore Ts'o );
178bf699327STheodore Ts'o 
179bf699327STheodore Ts'o TRACE_EVENT(jbd2_checkpoint_stats,
180bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
181bf699327STheodore Ts'o 		 struct transaction_chp_stats_s *stats),
182bf699327STheodore Ts'o 
183bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
184bf699327STheodore Ts'o 
185bf699327STheodore Ts'o 	TP_STRUCT__entry(
1860562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
187bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
188bf699327STheodore Ts'o 		__field(	unsigned long,	chp_time	)
189bf699327STheodore Ts'o 		__field(		__u32,	forced_to_close	)
190bf699327STheodore Ts'o 		__field(		__u32,	written		)
191bf699327STheodore Ts'o 		__field(		__u32,	dropped		)
192bf699327STheodore Ts'o 	),
193bf699327STheodore Ts'o 
194bf699327STheodore Ts'o 	TP_fast_assign(
1950562e0baSJiaying Zhang 		__entry->dev		= dev;
196bf699327STheodore Ts'o 		__entry->tid		= tid;
197bf699327STheodore Ts'o 		__entry->chp_time	= stats->cs_chp_time;
198bf699327STheodore Ts'o 		__entry->forced_to_close= stats->cs_forced_to_close;
199bf699327STheodore Ts'o 		__entry->written	= stats->cs_written;
200bf699327STheodore Ts'o 		__entry->dropped	= stats->cs_dropped;
201bf699327STheodore Ts'o 	),
202bf699327STheodore Ts'o 
2034862fd60STheodore Ts'o 	TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
204bf699327STheodore Ts'o 		  "written %u dropped %u",
2054862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
206bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->chp_time),
207bf699327STheodore Ts'o 		  __entry->forced_to_close, __entry->written, __entry->dropped)
208bf699327STheodore Ts'o );
209bf699327STheodore Ts'o 
21071f2be21STheodore Ts'o TRACE_EVENT(jbd2_cleanup_journal_tail,
21171f2be21STheodore Ts'o 
21271f2be21STheodore Ts'o 	TP_PROTO(journal_t *journal, tid_t first_tid,
21371f2be21STheodore Ts'o 		 unsigned long block_nr, unsigned long freed),
21471f2be21STheodore Ts'o 
21571f2be21STheodore Ts'o 	TP_ARGS(journal, first_tid, block_nr, freed),
21671f2be21STheodore Ts'o 
21771f2be21STheodore Ts'o 	TP_STRUCT__entry(
2180562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
21971f2be21STheodore Ts'o 		__field(	tid_t,	tail_sequence		)
22071f2be21STheodore Ts'o 		__field(	tid_t,	first_tid		)
22171f2be21STheodore Ts'o 		__field(unsigned long,	block_nr		)
22271f2be21STheodore Ts'o 		__field(unsigned long,	freed			)
22371f2be21STheodore Ts'o 	),
22471f2be21STheodore Ts'o 
22571f2be21STheodore Ts'o 	TP_fast_assign(
2260562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
22771f2be21STheodore Ts'o 		__entry->tail_sequence	= journal->j_tail_sequence;
22871f2be21STheodore Ts'o 		__entry->first_tid	= first_tid;
22971f2be21STheodore Ts'o 		__entry->block_nr	= block_nr;
23071f2be21STheodore Ts'o 		__entry->freed		= freed;
23171f2be21STheodore Ts'o 	),
23271f2be21STheodore Ts'o 
2334862fd60STheodore Ts'o 	TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
2344862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2354862fd60STheodore Ts'o 		  __entry->tail_sequence, __entry->first_tid,
2364862fd60STheodore Ts'o 		  __entry->block_nr, __entry->freed)
23771f2be21STheodore Ts'o );
23871f2be21STheodore Ts'o 
239*24bcc89cSJan Kara TRACE_EVENT(jbd2_write_superblock,
2402201c590SSeiji Aguchi 
241*24bcc89cSJan Kara 	TP_PROTO(journal_t *journal),
2422201c590SSeiji Aguchi 
243*24bcc89cSJan Kara 	TP_ARGS(journal),
2442201c590SSeiji Aguchi 
2452201c590SSeiji Aguchi 	TP_STRUCT__entry(
2462201c590SSeiji Aguchi 		__field(	dev_t,  dev			)
2472201c590SSeiji Aguchi 	),
2482201c590SSeiji Aguchi 
2492201c590SSeiji Aguchi 	TP_fast_assign(
2502201c590SSeiji Aguchi 		__entry->dev		= journal->j_fs_dev->bd_dev;
2512201c590SSeiji Aguchi 	),
2522201c590SSeiji Aguchi 
253*24bcc89cSJan Kara 	TP_printk("dev %d,%d", MAJOR(__entry->dev), MINOR(__entry->dev))
2542201c590SSeiji Aguchi );
2552201c590SSeiji Aguchi 
256879c5e6bSTheodore Ts'o #endif /* _TRACE_JBD2_H */
257879c5e6bSTheodore Ts'o 
258879c5e6bSTheodore Ts'o /* This part must be outside protection */
259879c5e6bSTheodore Ts'o #include <trace/define_trace.h>
260