xref: /linux/include/trace/events/jbd2.h (revision 4862fd6047ed02e2726667c54d35f538eecc56aa)
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 
29*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d result %d",
30*4862fd60STheodore 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 
51*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d transaction %d sync %d",
52*4862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
53*4862fd60STheodore 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 
84879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_end_commit,
85879c5e6bSTheodore Ts'o 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
86879c5e6bSTheodore Ts'o 
87879c5e6bSTheodore Ts'o 	TP_ARGS(journal, commit_transaction),
88879c5e6bSTheodore Ts'o 
89879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
900562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
91879c5e6bSTheodore Ts'o 		__field(	char,	sync_commit		  )
92879c5e6bSTheodore Ts'o 		__field(	int,	transaction		  )
93879c5e6bSTheodore Ts'o 		__field(	int,	head		  	  )
94879c5e6bSTheodore Ts'o 	),
95879c5e6bSTheodore Ts'o 
96879c5e6bSTheodore Ts'o 	TP_fast_assign(
970562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
98879c5e6bSTheodore Ts'o 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
99879c5e6bSTheodore Ts'o 		__entry->transaction	= commit_transaction->t_tid;
100879c5e6bSTheodore Ts'o 		__entry->head		= journal->j_tail_sequence;
101879c5e6bSTheodore Ts'o 	),
102879c5e6bSTheodore Ts'o 
103*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d transaction %d sync %d head %d",
104*4862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
105*4862fd60STheodore Ts'o 		  __entry->transaction, __entry->sync_commit, __entry->head)
106879c5e6bSTheodore Ts'o );
107879c5e6bSTheodore Ts'o 
108879c5e6bSTheodore Ts'o TRACE_EVENT(jbd2_submit_inode_data,
109879c5e6bSTheodore Ts'o 	TP_PROTO(struct inode *inode),
110879c5e6bSTheodore Ts'o 
111879c5e6bSTheodore Ts'o 	TP_ARGS(inode),
112879c5e6bSTheodore Ts'o 
113879c5e6bSTheodore Ts'o 	TP_STRUCT__entry(
1140562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
115879c5e6bSTheodore Ts'o 		__field(	ino_t,	ino			)
116879c5e6bSTheodore Ts'o 	),
117879c5e6bSTheodore Ts'o 
118879c5e6bSTheodore Ts'o 	TP_fast_assign(
1190562e0baSJiaying Zhang 		__entry->dev	= inode->i_sb->s_dev;
120879c5e6bSTheodore Ts'o 		__entry->ino	= inode->i_ino;
121879c5e6bSTheodore Ts'o 	),
122879c5e6bSTheodore Ts'o 
123*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d ino %lu",
124*4862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
125*4862fd60STheodore Ts'o 		  (unsigned long) __entry->ino)
126879c5e6bSTheodore Ts'o );
127879c5e6bSTheodore Ts'o 
128bf699327STheodore Ts'o TRACE_EVENT(jbd2_run_stats,
129bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
130bf699327STheodore Ts'o 		 struct transaction_run_stats_s *stats),
131bf699327STheodore Ts'o 
132bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
133bf699327STheodore Ts'o 
134bf699327STheodore Ts'o 	TP_STRUCT__entry(
1350562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
136bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
137bf699327STheodore Ts'o 		__field(	unsigned long,	wait		)
138bf699327STheodore Ts'o 		__field(	unsigned long,	running		)
139bf699327STheodore Ts'o 		__field(	unsigned long,	locked		)
140bf699327STheodore Ts'o 		__field(	unsigned long,	flushing	)
141bf699327STheodore Ts'o 		__field(	unsigned long,	logging		)
142bf699327STheodore Ts'o 		__field(		__u32,	handle_count	)
143bf699327STheodore Ts'o 		__field(		__u32,	blocks		)
144bf699327STheodore Ts'o 		__field(		__u32,	blocks_logged	)
145bf699327STheodore Ts'o 	),
146bf699327STheodore Ts'o 
147bf699327STheodore Ts'o 	TP_fast_assign(
1480562e0baSJiaying Zhang 		__entry->dev		= dev;
149bf699327STheodore Ts'o 		__entry->tid		= tid;
150bf699327STheodore Ts'o 		__entry->wait		= stats->rs_wait;
151bf699327STheodore Ts'o 		__entry->running	= stats->rs_running;
152bf699327STheodore Ts'o 		__entry->locked		= stats->rs_locked;
153bf699327STheodore Ts'o 		__entry->flushing	= stats->rs_flushing;
154bf699327STheodore Ts'o 		__entry->logging	= stats->rs_logging;
155bf699327STheodore Ts'o 		__entry->handle_count	= stats->rs_handle_count;
156bf699327STheodore Ts'o 		__entry->blocks		= stats->rs_blocks;
157bf699327STheodore Ts'o 		__entry->blocks_logged	= stats->rs_blocks_logged;
158bf699327STheodore Ts'o 	),
159bf699327STheodore Ts'o 
160*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d tid %lu wait %u running %u locked %u flushing %u "
161bf699327STheodore Ts'o 		  "logging %u handle_count %u blocks %u blocks_logged %u",
162*4862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
163bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->wait),
164bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->running),
165bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->locked),
166bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->flushing),
167bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->logging),
168bf699327STheodore Ts'o 		  __entry->handle_count, __entry->blocks,
169bf699327STheodore Ts'o 		  __entry->blocks_logged)
170bf699327STheodore Ts'o );
171bf699327STheodore Ts'o 
172bf699327STheodore Ts'o TRACE_EVENT(jbd2_checkpoint_stats,
173bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
174bf699327STheodore Ts'o 		 struct transaction_chp_stats_s *stats),
175bf699327STheodore Ts'o 
176bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
177bf699327STheodore Ts'o 
178bf699327STheodore Ts'o 	TP_STRUCT__entry(
1790562e0baSJiaying Zhang 		__field(		dev_t,	dev		)
180bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
181bf699327STheodore Ts'o 		__field(	unsigned long,	chp_time	)
182bf699327STheodore Ts'o 		__field(		__u32,	forced_to_close	)
183bf699327STheodore Ts'o 		__field(		__u32,	written		)
184bf699327STheodore Ts'o 		__field(		__u32,	dropped		)
185bf699327STheodore Ts'o 	),
186bf699327STheodore Ts'o 
187bf699327STheodore Ts'o 	TP_fast_assign(
1880562e0baSJiaying Zhang 		__entry->dev		= dev;
189bf699327STheodore Ts'o 		__entry->tid		= tid;
190bf699327STheodore Ts'o 		__entry->chp_time	= stats->cs_chp_time;
191bf699327STheodore Ts'o 		__entry->forced_to_close= stats->cs_forced_to_close;
192bf699327STheodore Ts'o 		__entry->written	= stats->cs_written;
193bf699327STheodore Ts'o 		__entry->dropped	= stats->cs_dropped;
194bf699327STheodore Ts'o 	),
195bf699327STheodore Ts'o 
196*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
197bf699327STheodore Ts'o 		  "written %u dropped %u",
198*4862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
199bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->chp_time),
200bf699327STheodore Ts'o 		  __entry->forced_to_close, __entry->written, __entry->dropped)
201bf699327STheodore Ts'o );
202bf699327STheodore Ts'o 
20371f2be21STheodore Ts'o TRACE_EVENT(jbd2_cleanup_journal_tail,
20471f2be21STheodore Ts'o 
20571f2be21STheodore Ts'o 	TP_PROTO(journal_t *journal, tid_t first_tid,
20671f2be21STheodore Ts'o 		 unsigned long block_nr, unsigned long freed),
20771f2be21STheodore Ts'o 
20871f2be21STheodore Ts'o 	TP_ARGS(journal, first_tid, block_nr, freed),
20971f2be21STheodore Ts'o 
21071f2be21STheodore Ts'o 	TP_STRUCT__entry(
2110562e0baSJiaying Zhang 		__field(	dev_t,	dev			)
21271f2be21STheodore Ts'o 		__field(	tid_t,	tail_sequence		)
21371f2be21STheodore Ts'o 		__field(	tid_t,	first_tid		)
21471f2be21STheodore Ts'o 		__field(unsigned long,	block_nr		)
21571f2be21STheodore Ts'o 		__field(unsigned long,	freed			)
21671f2be21STheodore Ts'o 	),
21771f2be21STheodore Ts'o 
21871f2be21STheodore Ts'o 	TP_fast_assign(
2190562e0baSJiaying Zhang 		__entry->dev		= journal->j_fs_dev->bd_dev;
22071f2be21STheodore Ts'o 		__entry->tail_sequence	= journal->j_tail_sequence;
22171f2be21STheodore Ts'o 		__entry->first_tid	= first_tid;
22271f2be21STheodore Ts'o 		__entry->block_nr	= block_nr;
22371f2be21STheodore Ts'o 		__entry->freed		= freed;
22471f2be21STheodore Ts'o 	),
22571f2be21STheodore Ts'o 
226*4862fd60STheodore Ts'o 	TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
227*4862fd60STheodore Ts'o 		  MAJOR(__entry->dev), MINOR(__entry->dev),
228*4862fd60STheodore Ts'o 		  __entry->tail_sequence, __entry->first_tid,
229*4862fd60STheodore Ts'o 		  __entry->block_nr, __entry->freed)
23071f2be21STheodore Ts'o );
23171f2be21STheodore Ts'o 
232879c5e6bSTheodore Ts'o #endif /* _TRACE_JBD2_H */
233879c5e6bSTheodore Ts'o 
234879c5e6bSTheodore Ts'o /* This part must be outside protection */
235879c5e6bSTheodore Ts'o #include <trace/define_trace.h>
236