1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM jbd2
5 #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/jbd2.h>
9 #include <linux/tracepoint.h>
11 struct transaction_chp_stats_s;
12 struct transaction_run_stats_s;
14 TRACE_EVENT(jbd2_checkpoint,
16 TP_PROTO(journal_t *journal, int result),
18 TP_ARGS(journal, result),
22 __field( int, result )
26 __entry->dev = journal->j_fs_dev->bd_dev;
27 __entry->result = result;
30 TP_printk("dev %d,%d result %d",
31 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
34 DECLARE_EVENT_CLASS(jbd2_commit,
36 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
38 TP_ARGS(journal, commit_transaction),
42 __field( char, sync_commit )
43 __field( tid_t, transaction )
47 __entry->dev = journal->j_fs_dev->bd_dev;
48 __entry->sync_commit = commit_transaction->t_synchronous_commit;
49 __entry->transaction = commit_transaction->t_tid;
52 TP_printk("dev %d,%d transaction %u sync %d",
53 MAJOR(__entry->dev), MINOR(__entry->dev),
54 __entry->transaction, __entry->sync_commit)
57 DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
59 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
61 TP_ARGS(journal, commit_transaction)
64 DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
66 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
68 TP_ARGS(journal, commit_transaction)
71 DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
73 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
75 TP_ARGS(journal, commit_transaction)
78 DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
80 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
82 TP_ARGS(journal, commit_transaction)
85 DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
87 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
89 TP_ARGS(journal, commit_transaction)
92 TRACE_EVENT(jbd2_end_commit,
93 TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
95 TP_ARGS(journal, commit_transaction),
99 __field( char, sync_commit )
100 __field( tid_t, transaction )
101 __field( tid_t, head )
105 __entry->dev = journal->j_fs_dev->bd_dev;
106 __entry->sync_commit = commit_transaction->t_synchronous_commit;
107 __entry->transaction = commit_transaction->t_tid;
108 __entry->head = journal->j_tail_sequence;
111 TP_printk("dev %d,%d transaction %u sync %d head %u",
112 MAJOR(__entry->dev), MINOR(__entry->dev),
113 __entry->transaction, __entry->sync_commit, __entry->head)
116 TRACE_EVENT(jbd2_submit_inode_data,
117 TP_PROTO(struct inode *inode),
122 __field( dev_t, dev )
123 __field( ino_t, ino )
127 __entry->dev = inode->i_sb->s_dev;
128 __entry->ino = inode->i_ino;
131 TP_printk("dev %d,%d ino %lu",
132 MAJOR(__entry->dev), MINOR(__entry->dev),
133 (unsigned long) __entry->ino)
136 DECLARE_EVENT_CLASS(jbd2_handle_start_class,
137 TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
138 unsigned int line_no, int requested_blocks),
140 TP_ARGS(dev, tid, type, line_no, requested_blocks),
143 __field( dev_t, dev )
144 __field( tid_t, tid )
145 __field( unsigned int, type )
146 __field( unsigned int, line_no )
147 __field( int, requested_blocks)
153 __entry->type = type;
154 __entry->line_no = line_no;
155 __entry->requested_blocks = requested_blocks;
158 TP_printk("dev %d,%d tid %u type %u line_no %u "
159 "requested_blocks %d",
160 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
161 __entry->type, __entry->line_no, __entry->requested_blocks)
164 DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_start,
165 TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
166 unsigned int line_no, int requested_blocks),
168 TP_ARGS(dev, tid, type, line_no, requested_blocks)
171 DEFINE_EVENT(jbd2_handle_start_class, jbd2_handle_restart,
172 TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
173 unsigned int line_no, int requested_blocks),
175 TP_ARGS(dev, tid, type, line_no, requested_blocks)
178 TRACE_EVENT(jbd2_handle_extend,
179 TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
180 unsigned int line_no, int buffer_credits,
181 int requested_blocks),
183 TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),
186 __field( dev_t, dev )
187 __field( tid_t, tid )
188 __field( unsigned int, type )
189 __field( unsigned int, line_no )
190 __field( int, buffer_credits )
191 __field( int, requested_blocks)
197 __entry->type = type;
198 __entry->line_no = line_no;
199 __entry->buffer_credits = buffer_credits;
200 __entry->requested_blocks = requested_blocks;
203 TP_printk("dev %d,%d tid %u type %u line_no %u "
204 "buffer_credits %d requested_blocks %d",
205 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
206 __entry->type, __entry->line_no, __entry->buffer_credits,
207 __entry->requested_blocks)
210 TRACE_EVENT(jbd2_handle_stats,
211 TP_PROTO(dev_t dev, tid_t tid, unsigned int type,
212 unsigned int line_no, int interval, int sync,
213 int requested_blocks, int dirtied_blocks),
215 TP_ARGS(dev, tid, type, line_no, interval, sync,
216 requested_blocks, dirtied_blocks),
219 __field( dev_t, dev )
220 __field( tid_t, tid )
221 __field( unsigned int, type )
222 __field( unsigned int, line_no )
223 __field( int, interval )
225 __field( int, requested_blocks)
226 __field( int, dirtied_blocks )
232 __entry->type = type;
233 __entry->line_no = line_no;
234 __entry->interval = interval;
235 __entry->sync = sync;
236 __entry->requested_blocks = requested_blocks;
237 __entry->dirtied_blocks = dirtied_blocks;
240 TP_printk("dev %d,%d tid %u type %u line_no %u interval %d "
241 "sync %d requested_blocks %d dirtied_blocks %d",
242 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
243 __entry->type, __entry->line_no, __entry->interval,
244 __entry->sync, __entry->requested_blocks,
245 __entry->dirtied_blocks)
248 TRACE_EVENT(jbd2_run_stats,
249 TP_PROTO(dev_t dev, tid_t tid,
250 struct transaction_run_stats_s *stats),
252 TP_ARGS(dev, tid, stats),
255 __field( dev_t, dev )
256 __field( tid_t, tid )
257 __field( unsigned long, wait )
258 __field( unsigned long, request_delay )
259 __field( unsigned long, running )
260 __field( unsigned long, locked )
261 __field( unsigned long, flushing )
262 __field( unsigned long, logging )
263 __field( __u32, handle_count )
264 __field( __u32, blocks )
265 __field( __u32, blocks_logged )
271 __entry->wait = stats->rs_wait;
272 __entry->request_delay = stats->rs_request_delay;
273 __entry->running = stats->rs_running;
274 __entry->locked = stats->rs_locked;
275 __entry->flushing = stats->rs_flushing;
276 __entry->logging = stats->rs_logging;
277 __entry->handle_count = stats->rs_handle_count;
278 __entry->blocks = stats->rs_blocks;
279 __entry->blocks_logged = stats->rs_blocks_logged;
282 TP_printk("dev %d,%d tid %u wait %u request_delay %u running %u "
283 "locked %u flushing %u logging %u handle_count %u "
284 "blocks %u blocks_logged %u",
285 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
286 jiffies_to_msecs(__entry->wait),
287 jiffies_to_msecs(__entry->request_delay),
288 jiffies_to_msecs(__entry->running),
289 jiffies_to_msecs(__entry->locked),
290 jiffies_to_msecs(__entry->flushing),
291 jiffies_to_msecs(__entry->logging),
292 __entry->handle_count, __entry->blocks,
293 __entry->blocks_logged)
296 TRACE_EVENT(jbd2_checkpoint_stats,
297 TP_PROTO(dev_t dev, tid_t tid,
298 struct transaction_chp_stats_s *stats),
300 TP_ARGS(dev, tid, stats),
303 __field( dev_t, dev )
304 __field( tid_t, tid )
305 __field( unsigned long, chp_time )
306 __field( __u32, forced_to_close )
307 __field( __u32, written )
308 __field( __u32, dropped )
314 __entry->chp_time = stats->cs_chp_time;
315 __entry->forced_to_close= stats->cs_forced_to_close;
316 __entry->written = stats->cs_written;
317 __entry->dropped = stats->cs_dropped;
320 TP_printk("dev %d,%d tid %u chp_time %u forced_to_close %u "
321 "written %u dropped %u",
322 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
323 jiffies_to_msecs(__entry->chp_time),
324 __entry->forced_to_close, __entry->written, __entry->dropped)
327 TRACE_EVENT(jbd2_update_log_tail,
329 TP_PROTO(journal_t *journal, tid_t first_tid,
330 unsigned long block_nr, unsigned long freed),
332 TP_ARGS(journal, first_tid, block_nr, freed),
335 __field( dev_t, dev )
336 __field( tid_t, tail_sequence )
337 __field( tid_t, first_tid )
338 __field(unsigned long, block_nr )
339 __field(unsigned long, freed )
343 __entry->dev = journal->j_fs_dev->bd_dev;
344 __entry->tail_sequence = journal->j_tail_sequence;
345 __entry->first_tid = first_tid;
346 __entry->block_nr = block_nr;
347 __entry->freed = freed;
350 TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
351 MAJOR(__entry->dev), MINOR(__entry->dev),
352 __entry->tail_sequence, __entry->first_tid,
353 __entry->block_nr, __entry->freed)
356 TRACE_EVENT(jbd2_write_superblock,
358 TP_PROTO(journal_t *journal, blk_opf_t write_flags),
360 TP_ARGS(journal, write_flags),
363 __field( dev_t, dev )
364 __field( blk_opf_t, write_flags )
368 __entry->dev = journal->j_fs_dev->bd_dev;
369 __entry->write_flags = write_flags;
372 TP_printk("dev %d,%d write_flags %x", MAJOR(__entry->dev),
373 MINOR(__entry->dev), (__force u32)__entry->write_flags)
376 TRACE_EVENT(jbd2_lock_buffer_stall,
378 TP_PROTO(dev_t dev, unsigned long stall_ms),
380 TP_ARGS(dev, stall_ms),
383 __field( dev_t, dev )
384 __field(unsigned long, stall_ms )
389 __entry->stall_ms = stall_ms;
392 TP_printk("dev %d,%d stall_ms %lu",
393 MAJOR(__entry->dev), MINOR(__entry->dev),
397 DECLARE_EVENT_CLASS(jbd2_journal_shrink,
399 TP_PROTO(journal_t *journal, unsigned long nr_to_scan,
400 unsigned long count),
402 TP_ARGS(journal, nr_to_scan, count),
406 __field(unsigned long, nr_to_scan)
407 __field(unsigned long, count)
411 __entry->dev = journal->j_fs_dev->bd_dev;
412 __entry->nr_to_scan = nr_to_scan;
413 __entry->count = count;
416 TP_printk("dev %d,%d nr_to_scan %lu count %lu",
417 MAJOR(__entry->dev), MINOR(__entry->dev),
418 __entry->nr_to_scan, __entry->count)
421 DEFINE_EVENT(jbd2_journal_shrink, jbd2_shrink_count,
423 TP_PROTO(journal_t *journal, unsigned long nr_to_scan, unsigned long count),
425 TP_ARGS(journal, nr_to_scan, count)
428 DEFINE_EVENT(jbd2_journal_shrink, jbd2_shrink_scan_enter,
430 TP_PROTO(journal_t *journal, unsigned long nr_to_scan, unsigned long count),
432 TP_ARGS(journal, nr_to_scan, count)
435 TRACE_EVENT(jbd2_shrink_scan_exit,
437 TP_PROTO(journal_t *journal, unsigned long nr_to_scan,
438 unsigned long nr_shrunk, unsigned long count),
440 TP_ARGS(journal, nr_to_scan, nr_shrunk, count),
444 __field(unsigned long, nr_to_scan)
445 __field(unsigned long, nr_shrunk)
446 __field(unsigned long, count)
450 __entry->dev = journal->j_fs_dev->bd_dev;
451 __entry->nr_to_scan = nr_to_scan;
452 __entry->nr_shrunk = nr_shrunk;
453 __entry->count = count;
456 TP_printk("dev %d,%d nr_to_scan %lu nr_shrunk %lu count %lu",
457 MAJOR(__entry->dev), MINOR(__entry->dev),
458 __entry->nr_to_scan, __entry->nr_shrunk,
462 TRACE_EVENT(jbd2_shrink_checkpoint_list,
464 TP_PROTO(journal_t *journal, tid_t first_tid, tid_t tid, tid_t last_tid,
465 unsigned long nr_freed, tid_t next_tid),
467 TP_ARGS(journal, first_tid, tid, last_tid, nr_freed, next_tid),
471 __field(tid_t, first_tid)
473 __field(tid_t, last_tid)
474 __field(unsigned long, nr_freed)
475 __field(tid_t, next_tid)
479 __entry->dev = journal->j_fs_dev->bd_dev;
480 __entry->first_tid = first_tid;
482 __entry->last_tid = last_tid;
483 __entry->nr_freed = nr_freed;
484 __entry->next_tid = next_tid;
487 TP_printk("dev %d,%d shrink transaction %u-%u(%u) freed %lu "
488 "next transaction %u",
489 MAJOR(__entry->dev), MINOR(__entry->dev),
490 __entry->first_tid, __entry->tid, __entry->last_tid,
491 __entry->nr_freed, __entry->next_tid)
494 #endif /* _TRACE_JBD2_H */
496 /* This part must be outside protection */
497 #include <trace/define_trace.h>