blob: c1d1f3eb242d2738456af4e1bf1443b057030d6c [file] [log] [blame]
Li Zefand0b6e042009-07-13 10:33:21 +08001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM jbd2
3
Theodore Ts'o879c5e62009-06-17 11:47:48 -04004#if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_JBD2_H
6
7#include <linux/jbd2.h>
8#include <linux/tracepoint.h>
9
Theodore Ts'obf699322009-09-30 00:32:06 -040010struct transaction_chp_stats_s;
11struct transaction_run_stats_s;
12
Theodore Ts'o879c5e62009-06-17 11:47:48 -040013TRACE_EVENT(jbd2_checkpoint,
14
15 TP_PROTO(journal_t *journal, int result),
16
17 TP_ARGS(journal, result),
18
19 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -040020 __field( dev_t, dev )
Theodore Ts'o879c5e62009-06-17 11:47:48 -040021 __field( int, result )
22 ),
23
24 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -040025 __entry->dev = journal->j_fs_dev->bd_dev;
Theodore Ts'o879c5e62009-06-17 11:47:48 -040026 __entry->result = result;
27 ),
28
Theodore Ts'o4862fd62011-07-10 22:05:08 -040029 TP_printk("dev %d,%d result %d",
30 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
Theodore Ts'o879c5e62009-06-17 11:47:48 -040031);
32
Li Zefan071688f2009-11-26 15:06:55 +080033DECLARE_EVENT_CLASS(jbd2_commit,
Theodore Ts'o879c5e62009-06-17 11:47:48 -040034
35 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
36
37 TP_ARGS(journal, commit_transaction),
38
39 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -040040 __field( dev_t, dev )
Theodore Ts'o879c5e62009-06-17 11:47:48 -040041 __field( char, sync_commit )
42 __field( int, transaction )
43 ),
44
45 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -040046 __entry->dev = journal->j_fs_dev->bd_dev;
Theodore Ts'o879c5e62009-06-17 11:47:48 -040047 __entry->sync_commit = commit_transaction->t_synchronous_commit;
48 __entry->transaction = commit_transaction->t_tid;
49 ),
50
Theodore Ts'o4862fd62011-07-10 22:05:08 -040051 TP_printk("dev %d,%d transaction %d sync %d",
52 MAJOR(__entry->dev), MINOR(__entry->dev),
53 __entry->transaction, __entry->sync_commit)
Theodore Ts'o879c5e62009-06-17 11:47:48 -040054);
55
Li Zefan071688f2009-11-26 15:06:55 +080056DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
Theodore Ts'o879c5e62009-06-17 11:47:48 -040057
58 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
59
Li Zefan071688f2009-11-26 15:06:55 +080060 TP_ARGS(journal, commit_transaction)
Theodore Ts'o879c5e62009-06-17 11:47:48 -040061);
62
Li Zefan071688f2009-11-26 15:06:55 +080063DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
Theodore Ts'o879c5e62009-06-17 11:47:48 -040064
65 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
66
Li Zefan071688f2009-11-26 15:06:55 +080067 TP_ARGS(journal, commit_transaction)
Theodore Ts'o879c5e62009-06-17 11:47:48 -040068);
69
Li Zefan071688f2009-11-26 15:06:55 +080070DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
Theodore Ts'o879c5e62009-06-17 11:47:48 -040071
72 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
73
Li Zefan071688f2009-11-26 15:06:55 +080074 TP_ARGS(journal, commit_transaction)
75);
Theodore Ts'o879c5e62009-06-17 11:47:48 -040076
Li Zefan071688f2009-11-26 15:06:55 +080077DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
Theodore Ts'o879c5e62009-06-17 11:47:48 -040078
Li Zefan071688f2009-11-26 15:06:55 +080079 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
Theodore Ts'o879c5e62009-06-17 11:47:48 -040080
Li Zefan071688f2009-11-26 15:06:55 +080081 TP_ARGS(journal, commit_transaction)
Theodore Ts'o879c5e62009-06-17 11:47:48 -040082);
83
Seiji Aguchi2201c592012-02-20 17:53:01 -050084DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
85
86 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
87
88 TP_ARGS(journal, commit_transaction)
89);
90
Theodore Ts'o879c5e62009-06-17 11:47:48 -040091TRACE_EVENT(jbd2_end_commit,
92 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
93
94 TP_ARGS(journal, commit_transaction),
95
96 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -040097 __field( dev_t, dev )
Theodore Ts'o879c5e62009-06-17 11:47:48 -040098 __field( char, sync_commit )
99 __field( int, transaction )
100 __field( int, head )
101 ),
102
103 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400104 __entry->dev = journal->j_fs_dev->bd_dev;
Theodore Ts'o879c5e62009-06-17 11:47:48 -0400105 __entry->sync_commit = commit_transaction->t_synchronous_commit;
106 __entry->transaction = commit_transaction->t_tid;
107 __entry->head = journal->j_tail_sequence;
108 ),
109
Theodore Ts'o4862fd62011-07-10 22:05:08 -0400110 TP_printk("dev %d,%d transaction %d sync %d head %d",
111 MAJOR(__entry->dev), MINOR(__entry->dev),
112 __entry->transaction, __entry->sync_commit, __entry->head)
Theodore Ts'o879c5e62009-06-17 11:47:48 -0400113);
114
115TRACE_EVENT(jbd2_submit_inode_data,
116 TP_PROTO(struct inode *inode),
117
118 TP_ARGS(inode),
119
120 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400121 __field( dev_t, dev )
Theodore Ts'o879c5e62009-06-17 11:47:48 -0400122 __field( ino_t, ino )
123 ),
124
125 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400126 __entry->dev = inode->i_sb->s_dev;
Theodore Ts'o879c5e62009-06-17 11:47:48 -0400127 __entry->ino = inode->i_ino;
128 ),
129
Theodore Ts'o4862fd62011-07-10 22:05:08 -0400130 TP_printk("dev %d,%d ino %lu",
131 MAJOR(__entry->dev), MINOR(__entry->dev),
132 (unsigned long) __entry->ino)
Theodore Ts'o879c5e62009-06-17 11:47:48 -0400133);
134
Theodore Ts'o343d9c22013-02-08 13:00:22 -0500135TRACE_EVENT(jbd2_handle_start,
136 TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
137 unsigned int line_no, int requested_blocks),
138
139 TP_ARGS(dev, tid, type, line_no, requested_blocks),
140
141 TP_STRUCT__entry(
142 __field( dev_t, dev )
143 __field( unsigned long, tid )
144 __field( unsigned int, type )
145 __field( unsigned int, line_no )
146 __field( int, requested_blocks)
147 ),
148
149 TP_fast_assign(
150 __entry->dev = dev;
151 __entry->tid = tid;
152 __entry->type = type;
153 __entry->line_no = line_no;
154 __entry->requested_blocks = requested_blocks;
155 ),
156
157 TP_printk("dev %d,%d tid %lu type %u line_no %u "
158 "requested_blocks %d",
159 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
160 __entry->type, __entry->line_no, __entry->requested_blocks)
161);
162
163TRACE_EVENT(jbd2_handle_extend,
164 TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
165 unsigned int line_no, int buffer_credits,
166 int requested_blocks),
167
168 TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),
169
170 TP_STRUCT__entry(
171 __field( dev_t, dev )
172 __field( unsigned long, tid )
173 __field( unsigned int, type )
174 __field( unsigned int, line_no )
175 __field( int, buffer_credits )
176 __field( int, requested_blocks)
177 ),
178
179 TP_fast_assign(
180 __entry->dev = dev;
181 __entry->tid = tid;
182 __entry->type = type;
183 __entry->line_no = line_no;
184 __entry->buffer_credits = buffer_credits;
185 __entry->requested_blocks = requested_blocks;
186 ),
187
188 TP_printk("dev %d,%d tid %lu type %u line_no %u "
189 "buffer_credits %d requested_blocks %d",
190 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
191 __entry->type, __entry->line_no, __entry->buffer_credits,
192 __entry->requested_blocks)
193);
194
195TRACE_EVENT(jbd2_handle_stats,
196 TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
197 unsigned int line_no, int interval, int sync,
198 int requested_blocks, int dirtied_blocks),
199
200 TP_ARGS(dev, tid, type, line_no, interval, sync,
201 requested_blocks, dirtied_blocks),
202
203 TP_STRUCT__entry(
204 __field( dev_t, dev )
205 __field( unsigned long, tid )
206 __field( unsigned int, type )
207 __field( unsigned int, line_no )
208 __field( int, interval )
209 __field( int, sync )
210 __field( int, requested_blocks)
211 __field( int, dirtied_blocks )
212 ),
213
214 TP_fast_assign(
215 __entry->dev = dev;
216 __entry->tid = tid;
217 __entry->type = type;
218 __entry->line_no = line_no;
219 __entry->interval = interval;
220 __entry->sync = sync;
221 __entry->requested_blocks = requested_blocks;
222 __entry->dirtied_blocks = dirtied_blocks;
223 ),
224
225 TP_printk("dev %d,%d tid %lu type %u line_no %u interval %d "
226 "sync %d requested_blocks %d dirtied_blocks %d",
227 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
228 __entry->type, __entry->line_no, __entry->interval,
229 __entry->sync, __entry->requested_blocks,
230 __entry->dirtied_blocks)
231);
232
Theodore Ts'obf699322009-09-30 00:32:06 -0400233TRACE_EVENT(jbd2_run_stats,
234 TP_PROTO(dev_t dev, unsigned long tid,
235 struct transaction_run_stats_s *stats),
236
237 TP_ARGS(dev, tid, stats),
238
239 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400240 __field( dev_t, dev )
Theodore Ts'obf699322009-09-30 00:32:06 -0400241 __field( unsigned long, tid )
242 __field( unsigned long, wait )
Theodore Ts'o9fff24a2013-02-06 22:30:23 -0500243 __field( unsigned long, request_delay )
Theodore Ts'obf699322009-09-30 00:32:06 -0400244 __field( unsigned long, running )
245 __field( unsigned long, locked )
246 __field( unsigned long, flushing )
247 __field( unsigned long, logging )
248 __field( __u32, handle_count )
249 __field( __u32, blocks )
250 __field( __u32, blocks_logged )
251 ),
252
253 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400254 __entry->dev = dev;
Theodore Ts'obf699322009-09-30 00:32:06 -0400255 __entry->tid = tid;
256 __entry->wait = stats->rs_wait;
Theodore Ts'o9fff24a2013-02-06 22:30:23 -0500257 __entry->request_delay = stats->rs_request_delay;
Theodore Ts'obf699322009-09-30 00:32:06 -0400258 __entry->running = stats->rs_running;
259 __entry->locked = stats->rs_locked;
260 __entry->flushing = stats->rs_flushing;
261 __entry->logging = stats->rs_logging;
262 __entry->handle_count = stats->rs_handle_count;
263 __entry->blocks = stats->rs_blocks;
264 __entry->blocks_logged = stats->rs_blocks_logged;
265 ),
266
Theodore Ts'o9fff24a2013-02-06 22:30:23 -0500267 TP_printk("dev %d,%d tid %lu wait %u request_delay %u running %u "
268 "locked %u flushing %u logging %u handle_count %u "
269 "blocks %u blocks_logged %u",
Theodore Ts'o4862fd62011-07-10 22:05:08 -0400270 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
Theodore Ts'obf699322009-09-30 00:32:06 -0400271 jiffies_to_msecs(__entry->wait),
Theodore Ts'o9fff24a2013-02-06 22:30:23 -0500272 jiffies_to_msecs(__entry->request_delay),
Theodore Ts'obf699322009-09-30 00:32:06 -0400273 jiffies_to_msecs(__entry->running),
274 jiffies_to_msecs(__entry->locked),
275 jiffies_to_msecs(__entry->flushing),
276 jiffies_to_msecs(__entry->logging),
277 __entry->handle_count, __entry->blocks,
278 __entry->blocks_logged)
279);
280
281TRACE_EVENT(jbd2_checkpoint_stats,
282 TP_PROTO(dev_t dev, unsigned long tid,
283 struct transaction_chp_stats_s *stats),
284
285 TP_ARGS(dev, tid, stats),
286
287 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400288 __field( dev_t, dev )
Theodore Ts'obf699322009-09-30 00:32:06 -0400289 __field( unsigned long, tid )
290 __field( unsigned long, chp_time )
291 __field( __u32, forced_to_close )
292 __field( __u32, written )
293 __field( __u32, dropped )
294 ),
295
296 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400297 __entry->dev = dev;
Theodore Ts'obf699322009-09-30 00:32:06 -0400298 __entry->tid = tid;
299 __entry->chp_time = stats->cs_chp_time;
300 __entry->forced_to_close= stats->cs_forced_to_close;
301 __entry->written = stats->cs_written;
302 __entry->dropped = stats->cs_dropped;
303 ),
304
Theodore Ts'o4862fd62011-07-10 22:05:08 -0400305 TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
Theodore Ts'obf699322009-09-30 00:32:06 -0400306 "written %u dropped %u",
Theodore Ts'o4862fd62011-07-10 22:05:08 -0400307 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
Theodore Ts'obf699322009-09-30 00:32:06 -0400308 jiffies_to_msecs(__entry->chp_time),
309 __entry->forced_to_close, __entry->written, __entry->dropped)
310);
311
Jan Kara79feb522012-03-13 22:22:54 -0400312TRACE_EVENT(jbd2_update_log_tail,
Theodore Ts'o71f2be22009-12-23 07:45:44 -0500313
314 TP_PROTO(journal_t *journal, tid_t first_tid,
315 unsigned long block_nr, unsigned long freed),
316
317 TP_ARGS(journal, first_tid, block_nr, freed),
318
319 TP_STRUCT__entry(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400320 __field( dev_t, dev )
Theodore Ts'o71f2be22009-12-23 07:45:44 -0500321 __field( tid_t, tail_sequence )
322 __field( tid_t, first_tid )
323 __field(unsigned long, block_nr )
324 __field(unsigned long, freed )
325 ),
326
327 TP_fast_assign(
Jiaying Zhang0562e0b2011-03-21 21:38:05 -0400328 __entry->dev = journal->j_fs_dev->bd_dev;
Theodore Ts'o71f2be22009-12-23 07:45:44 -0500329 __entry->tail_sequence = journal->j_tail_sequence;
330 __entry->first_tid = first_tid;
331 __entry->block_nr = block_nr;
332 __entry->freed = freed;
333 ),
334
Theodore Ts'o4862fd62011-07-10 22:05:08 -0400335 TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
336 MAJOR(__entry->dev), MINOR(__entry->dev),
337 __entry->tail_sequence, __entry->first_tid,
338 __entry->block_nr, __entry->freed)
Theodore Ts'o71f2be22009-12-23 07:45:44 -0500339);
340
Jan Kara24bcc892012-03-13 15:41:04 -0400341TRACE_EVENT(jbd2_write_superblock,
Seiji Aguchi2201c592012-02-20 17:53:01 -0500342
Jan Kara79feb522012-03-13 22:22:54 -0400343 TP_PROTO(journal_t *journal, int write_op),
Seiji Aguchi2201c592012-02-20 17:53:01 -0500344
Jan Kara79feb522012-03-13 22:22:54 -0400345 TP_ARGS(journal, write_op),
Seiji Aguchi2201c592012-02-20 17:53:01 -0500346
347 TP_STRUCT__entry(
348 __field( dev_t, dev )
Jan Kara79feb522012-03-13 22:22:54 -0400349 __field( int, write_op )
Seiji Aguchi2201c592012-02-20 17:53:01 -0500350 ),
351
352 TP_fast_assign(
353 __entry->dev = journal->j_fs_dev->bd_dev;
Jan Kara79feb522012-03-13 22:22:54 -0400354 __entry->write_op = write_op;
Seiji Aguchi2201c592012-02-20 17:53:01 -0500355 ),
356
Jan Kara79feb522012-03-13 22:22:54 -0400357 TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
358 MINOR(__entry->dev), __entry->write_op)
Seiji Aguchi2201c592012-02-20 17:53:01 -0500359);
360
Theodore Ts'of783f092013-04-21 16:47:54 -0400361TRACE_EVENT(jbd2_lock_buffer_stall,
362
363 TP_PROTO(dev_t dev, unsigned long stall_ms),
364
365 TP_ARGS(dev, stall_ms),
366
367 TP_STRUCT__entry(
368 __field( dev_t, dev )
369 __field(unsigned long, stall_ms )
370 ),
371
372 TP_fast_assign(
373 __entry->dev = dev;
374 __entry->stall_ms = stall_ms;
375 ),
376
377 TP_printk("dev %d,%d stall_ms %lu",
378 MAJOR(__entry->dev), MINOR(__entry->dev),
379 __entry->stall_ms)
380);
381
Theodore Ts'o879c5e62009-06-17 11:47:48 -0400382#endif /* _TRACE_JBD2_H */
383
384/* This part must be outside protection */
385#include <trace/define_trace.h>