xref: /linux/include/trace/events/jbd2.h (revision a1c613ae4c322ddd58d5a8539dbfba2a0380a8c0)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d0b6e04aSLi Zefan #undef TRACE_SYSTEM
3d0b6e04aSLi Zefan #define TRACE_SYSTEM jbd2
4d0b6e04aSLi Zefan 
5879c5e6bSTheodore Ts'o #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
6879c5e6bSTheodore Ts'o #define _TRACE_JBD2_H
7879c5e6bSTheodore Ts'o 
8879c5e6bSTheodore Ts'o #include <linux/jbd2.h>
9879c5e6bSTheodore Ts'o #include <linux/tracepoint.h>
10879c5e6bSTheodore Ts'o 
11bf699327STheodore Ts'o struct transaction_chp_stats_s;
12bf699327STheodore Ts'o struct transaction_run_stats_s;
13bf699327STheodore Ts'o 
14879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_checkpoint,
15879c5e6bSTheodore Ts'o 
16879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, int result),
17879c5e6bSTheodore Ts'o 
18879c5e6bSTheodore Ts'o 	TP_ARGS(journal, result),
19879c5e6bSTheodore Ts'o 
20879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
210562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
22879c5e6bSTheodore Ts'o 		__field(	int,	result			)
23879c5e6bSTheodore Ts'o 	),
24879c5e6bSTheodore Ts'o 
25879c5e6bSTheodore Ts'o 	TP_fast_assign(
260562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
27879c5e6bSTheodore Ts'o 		__entry->result		= result;
28879c5e6bSTheodore Ts'o 	),
29879c5e6bSTheodore Ts'o 
304862fd60STheodore Ts'o 	TP_printk("dev %d,%d result %d",
314862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
32879c5e6bSTheodore Ts'o );
33879c5e6bSTheodore Ts'o 
34071688f3SLi Zefan DECLARE_EVENT_CLASS(jbd2_commit,
35879c5e6bSTheodore Ts'o 
36879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
37879c5e6bSTheodore Ts'o 
38879c5e6bSTheodore Ts'o 	TP_ARGS(journal, commit_transaction),
39879c5e6bSTheodore Ts'o 
40879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
410562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
42879c5e6bSTheodore Ts'o 		__field(	char,	sync_commit		  )
43d87a7b4cSBixuan Cui 		__field(	tid_t,	transaction		  )
44879c5e6bSTheodore Ts'o 	),
45879c5e6bSTheodore Ts'o 
46879c5e6bSTheodore Ts'o 	TP_fast_assign(
470562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
48879c5e6bSTheodore Ts'o 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
49879c5e6bSTheodore Ts'o 		__entry->transaction	= commit_transaction->t_tid;
50879c5e6bSTheodore Ts'o 	),
51879c5e6bSTheodore Ts'o 
52d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d transaction %u sync %d",
534862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
544862fd60STheodore Ts'o 		  __entry->transaction, __entry->sync_commit)
55879c5e6bSTheodore Ts'o );
56879c5e6bSTheodore Ts'o 
57071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
58879c5e6bSTheodore Ts'o 
59879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
60879c5e6bSTheodore Ts'o 
61071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
62879c5e6bSTheodore Ts'o );
63879c5e6bSTheodore Ts'o 
64071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
65879c5e6bSTheodore Ts'o 
66879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
67879c5e6bSTheodore Ts'o 
68071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
69879c5e6bSTheodore Ts'o );
70879c5e6bSTheodore Ts'o 
71071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
72879c5e6bSTheodore Ts'o 
73879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
74879c5e6bSTheodore Ts'o 
75071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
76071688f3SLi Zefan );
77879c5e6bSTheodore Ts'o 
78071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
79879c5e6bSTheodore Ts'o 
80071688f3SLi Zefan 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
81879c5e6bSTheodore Ts'o 
82071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
83879c5e6bSTheodore Ts'o );
84879c5e6bSTheodore Ts'o 
852201c590SSeiji Aguchi DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
862201c590SSeiji Aguchi 
872201c590SSeiji Aguchi 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
882201c590SSeiji Aguchi 
892201c590SSeiji Aguchi 	TP_ARGS(journal, commit_transaction)
902201c590SSeiji Aguchi );
912201c590SSeiji Aguchi 
92879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_end_commit,
93879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
94879c5e6bSTheodore Ts'o 
95879c5e6bSTheodore Ts'o 	TP_ARGS(journal, commit_transaction),
96879c5e6bSTheodore Ts'o 
97879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
980562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
99879c5e6bSTheodore Ts'o 		__field(	char,	sync_commit		  )
100d87a7b4cSBixuan Cui 		__field(	tid_t,	transaction		  )
101d87a7b4cSBixuan Cui 		__field(	tid_t,	head		  	  )
102879c5e6bSTheodore Ts'o 	),
103879c5e6bSTheodore Ts'o 
104879c5e6bSTheodore Ts'o 	TP_fast_assign(
1050562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
106879c5e6bSTheodore Ts'o 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
107879c5e6bSTheodore Ts'o 		__entry->transaction	= commit_transaction->t_tid;
108879c5e6bSTheodore Ts'o 		__entry->head		= journal->j_tail_sequence;
109879c5e6bSTheodore Ts'o 	),
110879c5e6bSTheodore Ts'o 
111d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d transaction %u sync %d head %u",
1124862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1134862fd60STheodore Ts'o 		  __entry->transaction, __entry->sync_commit, __entry->head)
114879c5e6bSTheodore Ts'o );
115879c5e6bSTheodore Ts'o 
116879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_submit_inode_data,
117879c5e6bSTheodore Ts'o 	TP_PROTO(struct inode *inode),
118879c5e6bSTheodore Ts'o 
119879c5e6bSTheodore Ts'o 	TP_ARGS(inode),
120879c5e6bSTheodore Ts'o 
121879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
1220562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
123879c5e6bSTheodore Ts'o 		__field(	ino_t,	ino			)
124879c5e6bSTheodore Ts'o 	),
125879c5e6bSTheodore Ts'o 
126879c5e6bSTheodore Ts'o 	TP_fast_assign(
1270562e0baSJiaying Zhang 		__entry->dev	= inode->i_sb->s_dev;
128879c5e6bSTheodore Ts'o 		__entry->ino	= inode->i_ino;
129879c5e6bSTheodore Ts'o 	),
130879c5e6bSTheodore Ts'o 
1314862fd60STheodore Ts'o 	TP_printk("dev %d,%d ino %lu",
1324862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1334862fd60STheodore Ts'o 		  (unsigned long) __entry->ino)
134879c5e6bSTheodore Ts'o );
135879c5e6bSTheodore Ts'o 
1360094f981SJan Kara DECLARE_EVENT_CLASS(jbd2_handle_start_class,
137d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
138343d9c28STheodore Ts'o 		 unsigned int line_no, int requested_blocks),
139343d9c28STheodore Ts'o 
140343d9c28STheodore Ts'o 	TP_ARGS(dev, tid, type, line_no, requested_blocks),
141343d9c28STheodore Ts'o 
142343d9c28STheodore Ts'o 	TP_STRUCT__entry(
143343d9c28STheodore Ts'o 		__field(		dev_t,	dev		)
144d87a7b4cSBixuan Cui 		__field(		tid_t,	tid		)
145343d9c28STheodore Ts'o 		__field(	 unsigned int,	type		)
146343d9c28STheodore Ts'o 		__field(	 unsigned int,	line_no		)
147343d9c28STheodore Ts'o 		__field(		  int,	requested_blocks)
148343d9c28STheodore Ts'o 	),
149343d9c28STheodore Ts'o 
150343d9c28STheodore Ts'o 	TP_fast_assign(
151343d9c28STheodore Ts'o 		__entry->dev		  = dev;
152343d9c28STheodore Ts'o 		__entry->tid		  = tid;
153343d9c28STheodore Ts'o 		__entry->type		  = type;
154343d9c28STheodore Ts'o 		__entry->line_no	  = line_no;
155343d9c28STheodore Ts'o 		__entry->requested_blocks = requested_blocks;
156343d9c28STheodore Ts'o 	),
157343d9c28STheodore Ts'o 
158d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d tid %u type %u line_no %u "
159343d9c28STheodore Ts'o 		  "requested_blocks %d",
160343d9c28STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
161343d9c28STheodore Ts'o 		  __entry->type, __entry->line_no, __entry->requested_blocks)
162343d9c28STheodore Ts'o );
163343d9c28STheodore Ts'o 
1640094f981SJan Kara DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_start,
165d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
1660094f981SJan Kara 		 unsigned int line_no, int requested_blocks),
1670094f981SJan Kara 
1680094f981SJan Kara 	TP_ARGS(dev, tid, type, line_no, requested_blocks)
1690094f981SJan Kara );
1700094f981SJan Kara 
1710094f981SJan Kara DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_restart,
172d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
1730094f981SJan Kara 		 unsigned int line_no, int requested_blocks),
1740094f981SJan Kara 
1750094f981SJan Kara 	TP_ARGS(dev, tid, type, line_no, requested_blocks)
1760094f981SJan Kara );
1770094f981SJan Kara 
178343d9c28STheodore Ts'o TRACE_EVENT(jbd2_handle_extend,
179d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
180343d9c28STheodore Ts'o 		 unsigned int line_no, int buffer_credits,
181343d9c28STheodore Ts'o 		 int requested_blocks),
182343d9c28STheodore Ts'o 
183343d9c28STheodore Ts'o 	TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),
184343d9c28STheodore Ts'o 
185343d9c28STheodore Ts'o 	TP_STRUCT__entry(
186343d9c28STheodore Ts'o 		__field(		dev_t,	dev		)
187d87a7b4cSBixuan Cui 		__field(		tid_t,	tid		)
188343d9c28STheodore Ts'o 		__field(	 unsigned int,	type		)
189343d9c28STheodore Ts'o 		__field(	 unsigned int,	line_no		)
190343d9c28STheodore Ts'o 		__field(		  int,	buffer_credits  )
191343d9c28STheodore Ts'o 		__field(		  int,	requested_blocks)
192343d9c28STheodore Ts'o 	),
193343d9c28STheodore Ts'o 
194343d9c28STheodore Ts'o 	TP_fast_assign(
195343d9c28STheodore Ts'o 		__entry->dev		  = dev;
196343d9c28STheodore Ts'o 		__entry->tid		  = tid;
197343d9c28STheodore Ts'o 		__entry->type		  = type;
198343d9c28STheodore Ts'o 		__entry->line_no	  = line_no;
199343d9c28STheodore Ts'o 		__entry->buffer_credits   = buffer_credits;
200343d9c28STheodore Ts'o 		__entry->requested_blocks = requested_blocks;
201343d9c28STheodore Ts'o 	),
202343d9c28STheodore Ts'o 
203d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d tid %u type %u line_no %u "
204343d9c28STheodore Ts'o 		  "buffer_credits %d requested_blocks %d",
205343d9c28STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
206343d9c28STheodore Ts'o 		  __entry->type, __entry->line_no, __entry->buffer_credits,
207343d9c28STheodore Ts'o 		  __entry->requested_blocks)
208343d9c28STheodore Ts'o );
209343d9c28STheodore Ts'o 
210343d9c28STheodore Ts'o TRACE_EVENT(jbd2_handle_stats,
211d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
212343d9c28STheodore Ts'o 		 unsigned int line_no, int interval, int sync,
213343d9c28STheodore Ts'o 		 int requested_blocks, int dirtied_blocks),
214343d9c28STheodore Ts'o 
215343d9c28STheodore Ts'o 	TP_ARGS(dev, tid, type, line_no, interval, sync,
216343d9c28STheodore Ts'o 		requested_blocks, dirtied_blocks),
217343d9c28STheodore Ts'o 
218343d9c28STheodore Ts'o 	TP_STRUCT__entry(
219343d9c28STheodore Ts'o 		__field(		dev_t,	dev		)
220d87a7b4cSBixuan Cui 		__field(		tid_t,	tid		)
221343d9c28STheodore Ts'o 		__field(	 unsigned int,	type		)
222343d9c28STheodore Ts'o 		__field(	 unsigned int,	line_no		)
223343d9c28STheodore Ts'o 		__field(		  int,	interval	)
224343d9c28STheodore Ts'o 		__field(		  int,	sync		)
225343d9c28STheodore Ts'o 		__field(		  int,	requested_blocks)
226343d9c28STheodore Ts'o 		__field(		  int,	dirtied_blocks	)
227343d9c28STheodore Ts'o 	),
228343d9c28STheodore Ts'o 
229343d9c28STheodore Ts'o 	TP_fast_assign(
230343d9c28STheodore Ts'o 		__entry->dev		  = dev;
231343d9c28STheodore Ts'o 		__entry->tid		  = tid;
232343d9c28STheodore Ts'o 		__entry->type		  = type;
233343d9c28STheodore Ts'o 		__entry->line_no	  = line_no;
234343d9c28STheodore Ts'o 		__entry->interval	  = interval;
235343d9c28STheodore Ts'o 		__entry->sync		  = sync;
236343d9c28STheodore Ts'o 		__entry->requested_blocks = requested_blocks;
237343d9c28STheodore Ts'o 		__entry->dirtied_blocks	  = dirtied_blocks;
238343d9c28STheodore Ts'o 	),
239343d9c28STheodore Ts'o 
240d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d tid %u type %u line_no %u interval %d "
241343d9c28STheodore Ts'o 		  "sync %d requested_blocks %d dirtied_blocks %d",
242343d9c28STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
243343d9c28STheodore Ts'o 		  __entry->type, __entry->line_no, __entry->interval,
244343d9c28STheodore Ts'o 		  __entry->sync, __entry->requested_blocks,
245343d9c28STheodore Ts'o 		  __entry->dirtied_blocks)
246343d9c28STheodore Ts'o );
247343d9c28STheodore Ts'o 
248bf699327STheodore Ts'o TRACE_EVENT(jbd2_run_stats,
249d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid,
250bf699327STheodore Ts'o 		 struct transaction_run_stats_s *stats),
251bf699327STheodore Ts'o 
252bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
253bf699327STheodore Ts'o 
254bf699327STheodore Ts'o 	TP_STRUCT__entry(
2550562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
256d87a7b4cSBixuan Cui 		__field(		tid_t,	tid		)
257bf699327STheodore Ts'o 		__field(	unsigned long,	wait		)
2589fff24aaSTheodore Ts'o 		__field(	unsigned long,	request_delay	)
259bf699327STheodore Ts'o 		__field(	unsigned long,	running		)
260bf699327STheodore Ts'o 		__field(	unsigned long,	locked		)
261bf699327STheodore Ts'o 		__field(	unsigned long,	flushing	)
262bf699327STheodore Ts'o 		__field(	unsigned long,	logging		)
263bf699327STheodore Ts'o 		__field(		__u32,	handle_count	)
264bf699327STheodore Ts'o 		__field(		__u32,	blocks		)
265bf699327STheodore Ts'o 		__field(		__u32,	blocks_logged	)
266bf699327STheodore Ts'o 	),
267bf699327STheodore Ts'o 
268bf699327STheodore Ts'o 	TP_fast_assign(
2690562e0baSJiaying Zhang 		__entry->dev		= dev;
270bf699327STheodore Ts'o 		__entry->tid		= tid;
271bf699327STheodore Ts'o 		__entry->wait		= stats->rs_wait;
2729fff24aaSTheodore Ts'o 		__entry->request_delay	= stats->rs_request_delay;
273bf699327STheodore Ts'o 		__entry->running	= stats->rs_running;
274bf699327STheodore Ts'o 		__entry->locked		= stats->rs_locked;
275bf699327STheodore Ts'o 		__entry->flushing	= stats->rs_flushing;
276bf699327STheodore Ts'o 		__entry->logging	= stats->rs_logging;
277bf699327STheodore Ts'o 		__entry->handle_count	= stats->rs_handle_count;
278bf699327STheodore Ts'o 		__entry->blocks		= stats->rs_blocks;
279bf699327STheodore Ts'o 		__entry->blocks_logged	= stats->rs_blocks_logged;
280bf699327STheodore Ts'o 	),
281bf699327STheodore Ts'o 
282d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d tid %u wait %u request_delay %u running %u "
2839fff24aaSTheodore Ts'o 		  "locked %u flushing %u logging %u handle_count %u "
2849fff24aaSTheodore Ts'o 		  "blocks %u blocks_logged %u",
2854862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
286bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->wait),
2879fff24aaSTheodore Ts'o 		  jiffies_to_msecs(__entry->request_delay),
288bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->running),
289bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->locked),
290bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->flushing),
291bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->logging),
292bf699327STheodore Ts'o 		  __entry->handle_count, __entry->blocks,
293bf699327STheodore Ts'o 		  __entry->blocks_logged)
294bf699327STheodore Ts'o );
295bf699327STheodore Ts'o 
296bf699327STheodore Ts'o TRACE_EVENT(jbd2_checkpoint_stats,
297d87a7b4cSBixuan Cui 	TP_PROTO(dev_t dev, tid_t tid,
298bf699327STheodore Ts'o 		 struct transaction_chp_stats_s *stats),
299bf699327STheodore Ts'o 
300bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
301bf699327STheodore Ts'o 
302bf699327STheodore Ts'o 	TP_STRUCT__entry(
3030562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
304d87a7b4cSBixuan Cui 		__field(		tid_t,	tid		)
305bf699327STheodore Ts'o 		__field(	unsigned long,	chp_time	)
306bf699327STheodore Ts'o 		__field(		__u32,	forced_to_close	)
307bf699327STheodore Ts'o 		__field(		__u32,	written		)
308bf699327STheodore Ts'o 		__field(		__u32,	dropped		)
309bf699327STheodore Ts'o 	),
310bf699327STheodore Ts'o 
311bf699327STheodore Ts'o 	TP_fast_assign(
3120562e0baSJiaying Zhang 		__entry->dev		= dev;
313bf699327STheodore Ts'o 		__entry->tid		= tid;
314bf699327STheodore Ts'o 		__entry->chp_time	= stats->cs_chp_time;
315bf699327STheodore Ts'o 		__entry->forced_to_close= stats->cs_forced_to_close;
316bf699327STheodore Ts'o 		__entry->written	= stats->cs_written;
317bf699327STheodore Ts'o 		__entry->dropped	= stats->cs_dropped;
318bf699327STheodore Ts'o 	),
319bf699327STheodore Ts'o 
320d87a7b4cSBixuan Cui 	TP_printk("dev %d,%d tid %u chp_time %u forced_to_close %u "
321bf699327STheodore Ts'o 		  "written %u dropped %u",
3224862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
323bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->chp_time),
324bf699327STheodore Ts'o 		  __entry->forced_to_close, __entry->written, __entry->dropped)
325bf699327STheodore Ts'o );
326bf699327STheodore Ts'o 
32779feb521SJan Kara TRACE_EVENT(jbd2_update_log_tail,
32871f2be21STheodore Ts'o 
32971f2be21STheodore Ts'o 	TP_PROTO(journal_t *journal, tid_t first_tid,
33071f2be21STheodore Ts'o 		 unsigned long block_nr, unsigned long freed),
33171f2be21STheodore Ts'o 
33271f2be21STheodore Ts'o 	TP_ARGS(journal, first_tid, block_nr, freed),
33371f2be21STheodore Ts'o 
33471f2be21STheodore Ts'o 	TP_STRUCT__entry(
3350562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
33671f2be21STheodore Ts'o 		__field(	tid_t,	tail_sequence		)
33771f2be21STheodore Ts'o 		__field(	tid_t,	first_tid		)
33871f2be21STheodore Ts'o 		__field(unsigned long,	block_nr		)
33971f2be21STheodore Ts'o 		__field(unsigned long,	freed			)
34071f2be21STheodore Ts'o 	),
34171f2be21STheodore Ts'o 
34271f2be21STheodore Ts'o 	TP_fast_assign(
3430562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
34471f2be21STheodore Ts'o 		__entry->tail_sequence	= journal->j_tail_sequence;
34571f2be21STheodore Ts'o 		__entry->first_tid	= first_tid;
34671f2be21STheodore Ts'o 		__entry->block_nr	= block_nr;
34771f2be21STheodore Ts'o 		__entry->freed		= freed;
34871f2be21STheodore Ts'o 	),
34971f2be21STheodore Ts'o 
3504862fd60STheodore Ts'o 	TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
3514862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3524862fd60STheodore Ts'o 		  __entry->tail_sequence, __entry->first_tid,
3534862fd60STheodore Ts'o 		  __entry->block_nr, __entry->freed)
35471f2be21STheodore Ts'o );
35571f2be21STheodore Ts'o 
35624bcc89cSJan Kara TRACE_EVENT(jbd2_write_superblock,
3572201c590SSeiji Aguchi 
3586669797bSBart Van Assche 	TP_PROTO(journal_t *journal, blk_opf_t write_flags),
3592201c590SSeiji Aguchi 
3606669797bSBart Van Assche 	TP_ARGS(journal, write_flags),
3612201c590SSeiji Aguchi 
3622201c590SSeiji Aguchi 	TP_STRUCT__entry(
3632201c590SSeiji Aguchi 		__field(	dev_t,  dev			)
3646669797bSBart Van Assche 		__field(    blk_opf_t,  write_flags		)
3652201c590SSeiji Aguchi 	),
3662201c590SSeiji Aguchi 
3672201c590SSeiji Aguchi 	TP_fast_assign(
3682201c590SSeiji Aguchi 		__entry->dev		= journal->j_fs_dev->bd_dev;
3696669797bSBart Van Assche 		__entry->write_flags	= write_flags;
3702201c590SSeiji Aguchi 	),
3712201c590SSeiji Aguchi 
3726669797bSBart Van Assche 	TP_printk("dev %d,%d write_flags %x", MAJOR(__entry->dev),
3736669797bSBart Van Assche 		  MINOR(__entry->dev), (__force u32)__entry->write_flags)
3742201c590SSeiji Aguchi );
3752201c590SSeiji Aguchi 
376f783f091STheodore Ts'o TRACE_EVENT(jbd2_lock_buffer_stall,
377f783f091STheodore Ts'o 
378f783f091STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long stall_ms),
379f783f091STheodore Ts'o 
380f783f091STheodore Ts'o 	TP_ARGS(dev, stall_ms),
381f783f091STheodore Ts'o 
382f783f091STheodore Ts'o 	TP_STRUCT__entry(
383f783f091STheodore Ts'o 		__field(        dev_t, dev	)
384f783f091STheodore Ts'o 		__field(unsigned long, stall_ms	)
385f783f091STheodore Ts'o 	),
386f783f091STheodore Ts'o 
387f783f091STheodore Ts'o 	TP_fast_assign(
388f783f091STheodore Ts'o 		__entry->dev		= dev;
389f783f091STheodore Ts'o 		__entry->stall_ms	= stall_ms;
390f783f091STheodore Ts'o 	),
391f783f091STheodore Ts'o 
392f783f091STheodore Ts'o 	TP_printk("dev %d,%d stall_ms %lu",
393f783f091STheodore Ts'o 		MAJOR(__entry->dev), MINOR(__entry->dev),
394f783f091STheodore Ts'o 		__entry->stall_ms)
395f783f091STheodore Ts'o );
396f783f091STheodore Ts'o 
3974ba3fcddSZhang Yi DECLARE_EVENT_CLASS(jbd2_journal_shrink,
3984ba3fcddSZhang Yi 
3994ba3fcddSZhang Yi 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan,
4004ba3fcddSZhang Yi 		 unsigned long count),
4014ba3fcddSZhang Yi 
4024ba3fcddSZhang Yi 	TP_ARGS(journal, nr_to_scan, count),
4034ba3fcddSZhang Yi 
4044ba3fcddSZhang Yi 	TP_STRUCT__entry(
4054ba3fcddSZhang Yi 		__field(dev_t, dev)
4064ba3fcddSZhang Yi 		__field(unsigned long, nr_to_scan)
4074ba3fcddSZhang Yi 		__field(unsigned long, count)
4084ba3fcddSZhang Yi 	),
4094ba3fcddSZhang Yi 
4104ba3fcddSZhang Yi 	TP_fast_assign(
4114ba3fcddSZhang Yi 		__entry->dev		= journal->j_fs_dev->bd_dev;
4124ba3fcddSZhang Yi 		__entry->nr_to_scan	= nr_to_scan;
4134ba3fcddSZhang Yi 		__entry->count		= count;
4144ba3fcddSZhang Yi 	),
4154ba3fcddSZhang Yi 
4164ba3fcddSZhang Yi 	TP_printk("dev %d,%d nr_to_scan %lu count %lu",
4174ba3fcddSZhang Yi 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4184ba3fcddSZhang Yi 		  __entry->nr_to_scan, __entry->count)
4194ba3fcddSZhang Yi );
4204ba3fcddSZhang Yi 
4214ba3fcddSZhang Yi DEFINE_EVENT(jbd2_journal_shrink, jbd2_shrink_count,
4224ba3fcddSZhang Yi 
4234ba3fcddSZhang Yi 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan, unsigned long count),
4244ba3fcddSZhang Yi 
4254ba3fcddSZhang Yi 	TP_ARGS(journal, nr_to_scan, count)
4264ba3fcddSZhang Yi );
4274ba3fcddSZhang Yi 
4284ba3fcddSZhang Yi DEFINE_EVENT(jbd2_journal_shrink, jbd2_shrink_scan_enter,
4294ba3fcddSZhang Yi 
4304ba3fcddSZhang Yi 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan, unsigned long count),
4314ba3fcddSZhang Yi 
4324ba3fcddSZhang Yi 	TP_ARGS(journal, nr_to_scan, count)
4334ba3fcddSZhang Yi );
4344ba3fcddSZhang Yi 
4354ba3fcddSZhang Yi TRACE_EVENT(jbd2_shrink_scan_exit,
4364ba3fcddSZhang Yi 
4374ba3fcddSZhang Yi 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan,
4384ba3fcddSZhang Yi 		 unsigned long nr_shrunk, unsigned long count),
4394ba3fcddSZhang Yi 
4404ba3fcddSZhang Yi 	TP_ARGS(journal, nr_to_scan, nr_shrunk, count),
4414ba3fcddSZhang Yi 
4424ba3fcddSZhang Yi 	TP_STRUCT__entry(
4434ba3fcddSZhang Yi 		__field(dev_t, dev)
4444ba3fcddSZhang Yi 		__field(unsigned long, nr_to_scan)
4454ba3fcddSZhang Yi 		__field(unsigned long, nr_shrunk)
4464ba3fcddSZhang Yi 		__field(unsigned long, count)
4474ba3fcddSZhang Yi 	),
4484ba3fcddSZhang Yi 
4494ba3fcddSZhang Yi 	TP_fast_assign(
4504ba3fcddSZhang Yi 		__entry->dev		= journal->j_fs_dev->bd_dev;
4514ba3fcddSZhang Yi 		__entry->nr_to_scan	= nr_to_scan;
4524ba3fcddSZhang Yi 		__entry->nr_shrunk	= nr_shrunk;
4534ba3fcddSZhang Yi 		__entry->count		= count;
4544ba3fcddSZhang Yi 	),
4554ba3fcddSZhang Yi 
4564ba3fcddSZhang Yi 	TP_printk("dev %d,%d nr_to_scan %lu nr_shrunk %lu count %lu",
4574ba3fcddSZhang Yi 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4584ba3fcddSZhang Yi 		  __entry->nr_to_scan, __entry->nr_shrunk,
4594ba3fcddSZhang Yi 		  __entry->count)
4604ba3fcddSZhang Yi );
4614ba3fcddSZhang Yi 
4624ba3fcddSZhang Yi TRACE_EVENT(jbd2_shrink_checkpoint_list,
4634ba3fcddSZhang Yi 
4644ba3fcddSZhang Yi 	TP_PROTO(journal_t *journal, tid_t first_tid, tid_t tid, tid_t last_tid,
465*b98dba27SZhang Yi 		 unsigned long nr_freed, tid_t next_tid),
4664ba3fcddSZhang Yi 
467*b98dba27SZhang Yi 	TP_ARGS(journal, first_tid, tid, last_tid, nr_freed, next_tid),
4684ba3fcddSZhang Yi 
4694ba3fcddSZhang Yi 	TP_STRUCT__entry(
4704ba3fcddSZhang Yi 		__field(dev_t, dev)
4714ba3fcddSZhang Yi 		__field(tid_t, first_tid)
4724ba3fcddSZhang Yi 		__field(tid_t, tid)
4734ba3fcddSZhang Yi 		__field(tid_t, last_tid)
4744ba3fcddSZhang Yi 		__field(unsigned long, nr_freed)
4754ba3fcddSZhang Yi 		__field(tid_t, next_tid)
4764ba3fcddSZhang Yi 	),
4774ba3fcddSZhang Yi 
4784ba3fcddSZhang Yi 	TP_fast_assign(
4794ba3fcddSZhang Yi 		__entry->dev		= journal->j_fs_dev->bd_dev;
4804ba3fcddSZhang Yi 		__entry->first_tid	= first_tid;
4814ba3fcddSZhang Yi 		__entry->tid		= tid;
4824ba3fcddSZhang Yi 		__entry->last_tid	= last_tid;
4834ba3fcddSZhang Yi 		__entry->nr_freed	= nr_freed;
4844ba3fcddSZhang Yi 		__entry->next_tid	= next_tid;
4854ba3fcddSZhang Yi 	),
4864ba3fcddSZhang Yi 
4874ba3fcddSZhang Yi 	TP_printk("dev %d,%d shrink transaction %u-%u(%u) freed %lu "
488*b98dba27SZhang Yi 		  "next transaction %u",
4894ba3fcddSZhang Yi 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4904ba3fcddSZhang Yi 		  __entry->first_tid, __entry->tid, __entry->last_tid,
491*b98dba27SZhang Yi 		  __entry->nr_freed, __entry->next_tid)
4924ba3fcddSZhang Yi );
4934ba3fcddSZhang Yi 
494879c5e6bSTheodore Ts'o #endif /* _TRACE_JBD2_H */
495879c5e6bSTheodore Ts'o 
496879c5e6bSTheodore Ts'o /* This part must be outside protection */
497879c5e6bSTheodore Ts'o #include <trace/define_trace.h>
498