xref: /linux/include/trace/events/jbd2.h (revision 071688f36e7eba3e37b2fc48e35bfdab99b80b4d)
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(
20879c5e6bSTheodore Ts'o 		__field(	dev_t,	dev			)
21879c5e6bSTheodore Ts'o 		__field(	int,	result			)
22879c5e6bSTheodore Ts'o 	),
23879c5e6bSTheodore Ts'o 
24879c5e6bSTheodore Ts'o 	TP_fast_assign(
25879c5e6bSTheodore Ts'o 		__entry->dev		= journal->j_fs_dev->bd_dev;
26879c5e6bSTheodore Ts'o 		__entry->result		= result;
27879c5e6bSTheodore Ts'o 	),
28879c5e6bSTheodore Ts'o 
29879c5e6bSTheodore Ts'o 	TP_printk("dev %s result %d",
30879c5e6bSTheodore Ts'o 		  jbd2_dev_to_name(__entry->dev), __entry->result)
31879c5e6bSTheodore Ts'o );
32879c5e6bSTheodore Ts'o 
33*071688f3SLi 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(
40879c5e6bSTheodore Ts'o 		__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(
46879c5e6bSTheodore Ts'o 		__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 
51879c5e6bSTheodore Ts'o 	TP_printk("dev %s transaction %d sync %d",
52879c5e6bSTheodore Ts'o 		  jbd2_dev_to_name(__entry->dev), __entry->transaction,
53879c5e6bSTheodore Ts'o 		  __entry->sync_commit)
54879c5e6bSTheodore Ts'o );
55879c5e6bSTheodore Ts'o 
56*071688f3SLi 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 
60*071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
61879c5e6bSTheodore Ts'o );
62879c5e6bSTheodore Ts'o 
63*071688f3SLi 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 
67*071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
68879c5e6bSTheodore Ts'o );
69879c5e6bSTheodore Ts'o 
70*071688f3SLi 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 
74*071688f3SLi Zefan 	TP_ARGS(journal, commit_transaction)
75*071688f3SLi Zefan );
76879c5e6bSTheodore Ts'o 
77*071688f3SLi Zefan DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
78879c5e6bSTheodore Ts'o 
79*071688f3SLi Zefan 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
80879c5e6bSTheodore Ts'o 
81*071688f3SLi 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(
90879c5e6bSTheodore Ts'o 		__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(
97879c5e6bSTheodore Ts'o 		__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 
103879c5e6bSTheodore Ts'o 	TP_printk("dev %s transaction %d sync %d head %d",
104879c5e6bSTheodore Ts'o 		  jbd2_dev_to_name(__entry->dev), __entry->transaction,
105879c5e6bSTheodore Ts'o 		  __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(
114879c5e6bSTheodore Ts'o 		__field(	dev_t,	dev			)
115879c5e6bSTheodore Ts'o 		__field(	ino_t,	ino			)
116879c5e6bSTheodore Ts'o 	),
117879c5e6bSTheodore Ts'o 
118879c5e6bSTheodore Ts'o 	TP_fast_assign(
119879c5e6bSTheodore Ts'o 		__entry->dev	= inode->i_sb->s_dev;
120879c5e6bSTheodore Ts'o 		__entry->ino	= inode->i_ino;
121879c5e6bSTheodore Ts'o 	),
122879c5e6bSTheodore Ts'o 
123879c5e6bSTheodore Ts'o 	TP_printk("dev %s ino %lu",
124a3710fd1STheodore Ts'o 		  jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
125879c5e6bSTheodore Ts'o );
126879c5e6bSTheodore Ts'o 
127bf699327STheodore Ts'o TRACE_EVENT(jbd2_run_stats,
128bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
129bf699327STheodore Ts'o 		 struct transaction_run_stats_s *stats),
130bf699327STheodore Ts'o 
131bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
132bf699327STheodore Ts'o 
133bf699327STheodore Ts'o 	TP_STRUCT__entry(
134bf699327STheodore Ts'o 		__field(		dev_t,	dev		)
135bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
136bf699327STheodore Ts'o 		__field(	unsigned long,	wait		)
137bf699327STheodore Ts'o 		__field(	unsigned long,	running		)
138bf699327STheodore Ts'o 		__field(	unsigned long,	locked		)
139bf699327STheodore Ts'o 		__field(	unsigned long,	flushing	)
140bf699327STheodore Ts'o 		__field(	unsigned long,	logging		)
141bf699327STheodore Ts'o 		__field(		__u32,	handle_count	)
142bf699327STheodore Ts'o 		__field(		__u32,	blocks		)
143bf699327STheodore Ts'o 		__field(		__u32,	blocks_logged	)
144bf699327STheodore Ts'o 	),
145bf699327STheodore Ts'o 
146bf699327STheodore Ts'o 	TP_fast_assign(
147bf699327STheodore Ts'o 		__entry->dev		= dev;
148bf699327STheodore Ts'o 		__entry->tid		= tid;
149bf699327STheodore Ts'o 		__entry->wait		= stats->rs_wait;
150bf699327STheodore Ts'o 		__entry->running	= stats->rs_running;
151bf699327STheodore Ts'o 		__entry->locked		= stats->rs_locked;
152bf699327STheodore Ts'o 		__entry->flushing	= stats->rs_flushing;
153bf699327STheodore Ts'o 		__entry->logging	= stats->rs_logging;
154bf699327STheodore Ts'o 		__entry->handle_count	= stats->rs_handle_count;
155bf699327STheodore Ts'o 		__entry->blocks		= stats->rs_blocks;
156bf699327STheodore Ts'o 		__entry->blocks_logged	= stats->rs_blocks_logged;
157bf699327STheodore Ts'o 	),
158bf699327STheodore Ts'o 
159bf699327STheodore Ts'o 	TP_printk("dev %s tid %lu wait %u running %u locked %u flushing %u "
160bf699327STheodore Ts'o 		  "logging %u handle_count %u blocks %u blocks_logged %u",
161bf699327STheodore Ts'o 		  jbd2_dev_to_name(__entry->dev), __entry->tid,
162bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->wait),
163bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->running),
164bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->locked),
165bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->flushing),
166bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->logging),
167bf699327STheodore Ts'o 		  __entry->handle_count, __entry->blocks,
168bf699327STheodore Ts'o 		  __entry->blocks_logged)
169bf699327STheodore Ts'o );
170bf699327STheodore Ts'o 
171bf699327STheodore Ts'o TRACE_EVENT(jbd2_checkpoint_stats,
172bf699327STheodore Ts'o 	TP_PROTO(dev_t dev, unsigned long tid,
173bf699327STheodore Ts'o 		 struct transaction_chp_stats_s *stats),
174bf699327STheodore Ts'o 
175bf699327STheodore Ts'o 	TP_ARGS(dev, tid, stats),
176bf699327STheodore Ts'o 
177bf699327STheodore Ts'o 	TP_STRUCT__entry(
178bf699327STheodore Ts'o 		__field(		dev_t,	dev		)
179bf699327STheodore Ts'o 		__field(	unsigned long,	tid		)
180bf699327STheodore Ts'o 		__field(	unsigned long,	chp_time	)
181bf699327STheodore Ts'o 		__field(		__u32,	forced_to_close	)
182bf699327STheodore Ts'o 		__field(		__u32,	written		)
183bf699327STheodore Ts'o 		__field(		__u32,	dropped		)
184bf699327STheodore Ts'o 	),
185bf699327STheodore Ts'o 
186bf699327STheodore Ts'o 	TP_fast_assign(
187bf699327STheodore Ts'o 		__entry->dev		= dev;
188bf699327STheodore Ts'o 		__entry->tid		= tid;
189bf699327STheodore Ts'o 		__entry->chp_time	= stats->cs_chp_time;
190bf699327STheodore Ts'o 		__entry->forced_to_close= stats->cs_forced_to_close;
191bf699327STheodore Ts'o 		__entry->written	= stats->cs_written;
192bf699327STheodore Ts'o 		__entry->dropped	= stats->cs_dropped;
193bf699327STheodore Ts'o 	),
194bf699327STheodore Ts'o 
195bf699327STheodore Ts'o 	TP_printk("dev %s tid %lu chp_time %u forced_to_close %u "
196bf699327STheodore Ts'o 		  "written %u dropped %u",
197bf699327STheodore Ts'o 		  jbd2_dev_to_name(__entry->dev), __entry->tid,
198bf699327STheodore Ts'o 		  jiffies_to_msecs(__entry->chp_time),
199bf699327STheodore Ts'o 		  __entry->forced_to_close, __entry->written, __entry->dropped)
200bf699327STheodore Ts'o );
201bf699327STheodore Ts'o 
202879c5e6bSTheodore Ts'o #endif /* _TRACE_JBD2_H */
203879c5e6bSTheodore Ts'o 
204879c5e6bSTheodore Ts'o /* This part must be outside protection */
205879c5e6bSTheodore Ts'o #include <trace/define_trace.h>
206