xref: /openbmc/linux/include/trace/events/jbd2.h (revision 0c6dfa75)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM jbd2
4 
5 #if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_JBD2_H
7 
8 #include <linux/jbd2.h>
9 #include <linux/tracepoint.h>
10 
11 struct transaction_chp_stats_s;
12 struct transaction_run_stats_s;
13 
14 TRACE_EVENT(jbd2_checkpoint,
15 
16 	TP_PROTO(journal_t *journal, int result),
17 
18 	TP_ARGS(journal, result),
19 
20 	TP_STRUCT__entry(
21 		__field(	dev_t,	dev			)
22 		__field(	int,	result			)
23 	),
24 
25 	TP_fast_assign(
26 		__entry->dev		= journal->j_fs_dev->bd_dev;
27 		__entry->result		= result;
28 	),
29 
30 	TP_printk("dev %d,%d result %d",
31 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
32 );
33 
34 DECLARE_EVENT_CLASS(jbd2_commit,
35 
36 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
37 
38 	TP_ARGS(journal, commit_transaction),
39 
40 	TP_STRUCT__entry(
41 		__field(	dev_t,	dev			)
42 		__field(	char,	sync_commit		  )
43 		__field(	tid_t,	transaction		  )
44 	),
45 
46 	TP_fast_assign(
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;
50 	),
51 
52 	TP_printk("dev %d,%d transaction %u sync %d",
53 		  MAJOR(__entry->dev), MINOR(__entry->dev),
54 		  __entry->transaction, __entry->sync_commit)
55 );
56 
57 DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
58 
59 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
60 
61 	TP_ARGS(journal, commit_transaction)
62 );
63 
64 DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
65 
66 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
67 
68 	TP_ARGS(journal, commit_transaction)
69 );
70 
71 DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
72 
73 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
74 
75 	TP_ARGS(journal, commit_transaction)
76 );
77 
78 DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
79 
80 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
81 
82 	TP_ARGS(journal, commit_transaction)
83 );
84 
85 DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,
86 
87 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
88 
89 	TP_ARGS(journal, commit_transaction)
90 );
91 
92 TRACE_EVENT(jbd2_end_commit,
93 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
94 
95 	TP_ARGS(journal, commit_transaction),
96 
97 	TP_STRUCT__entry(
98 		__field(	dev_t,	dev			)
99 		__field(	char,	sync_commit		  )
100 		__field(	tid_t,	transaction		  )
101 		__field(	tid_t,	head		  	  )
102 	),
103 
104 	TP_fast_assign(
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;
109 	),
110 
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)
114 );
115 
116 TRACE_EVENT(jbd2_submit_inode_data,
117 	TP_PROTO(struct inode *inode),
118 
119 	TP_ARGS(inode),
120 
121 	TP_STRUCT__entry(
122 		__field(	dev_t,	dev			)
123 		__field(	ino_t,	ino			)
124 	),
125 
126 	TP_fast_assign(
127 		__entry->dev	= inode->i_sb->s_dev;
128 		__entry->ino	= inode->i_ino;
129 	),
130 
131 	TP_printk("dev %d,%d ino %lu",
132 		  MAJOR(__entry->dev), MINOR(__entry->dev),
133 		  (unsigned long) __entry->ino)
134 );
135 
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),
139 
140 	TP_ARGS(dev, tid, type, line_no, requested_blocks),
141 
142 	TP_STRUCT__entry(
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)
148 	),
149 
150 	TP_fast_assign(
151 		__entry->dev		  = dev;
152 		__entry->tid		  = tid;
153 		__entry->type		  = type;
154 		__entry->line_no	  = line_no;
155 		__entry->requested_blocks = requested_blocks;
156 	),
157 
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)
162 );
163 
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),
167 
168 	TP_ARGS(dev, tid, type, line_no, requested_blocks)
169 );
170 
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),
174 
175 	TP_ARGS(dev, tid, type, line_no, requested_blocks)
176 );
177 
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),
182 
183 	TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),
184 
185 	TP_STRUCT__entry(
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)
192 	),
193 
194 	TP_fast_assign(
195 		__entry->dev		  = dev;
196 		__entry->tid		  = tid;
197 		__entry->type		  = type;
198 		__entry->line_no	  = line_no;
199 		__entry->buffer_credits   = buffer_credits;
200 		__entry->requested_blocks = requested_blocks;
201 	),
202 
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)
208 );
209 
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),
214 
215 	TP_ARGS(dev, tid, type, line_no, interval, sync,
216 		requested_blocks, dirtied_blocks),
217 
218 	TP_STRUCT__entry(
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	)
224 		__field(		  int,	sync		)
225 		__field(		  int,	requested_blocks)
226 		__field(		  int,	dirtied_blocks	)
227 	),
228 
229 	TP_fast_assign(
230 		__entry->dev		  = dev;
231 		__entry->tid		  = tid;
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;
238 	),
239 
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)
246 );
247 
248 TRACE_EVENT(jbd2_run_stats,
249 	TP_PROTO(dev_t dev, tid_t tid,
250 		 struct transaction_run_stats_s *stats),
251 
252 	TP_ARGS(dev, tid, stats),
253 
254 	TP_STRUCT__entry(
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	)
266 	),
267 
268 	TP_fast_assign(
269 		__entry->dev		= dev;
270 		__entry->tid		= tid;
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;
280 	),
281 
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)
294 );
295 
296 TRACE_EVENT(jbd2_checkpoint_stats,
297 	TP_PROTO(dev_t dev, tid_t tid,
298 		 struct transaction_chp_stats_s *stats),
299 
300 	TP_ARGS(dev, tid, stats),
301 
302 	TP_STRUCT__entry(
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		)
309 	),
310 
311 	TP_fast_assign(
312 		__entry->dev		= dev;
313 		__entry->tid		= tid;
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;
318 	),
319 
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)
325 );
326 
327 TRACE_EVENT(jbd2_update_log_tail,
328 
329 	TP_PROTO(journal_t *journal, tid_t first_tid,
330 		 unsigned long block_nr, unsigned long freed),
331 
332 	TP_ARGS(journal, first_tid, block_nr, freed),
333 
334 	TP_STRUCT__entry(
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			)
340 	),
341 
342 	TP_fast_assign(
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;
348 	),
349 
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)
354 );
355 
356 TRACE_EVENT(jbd2_write_superblock,
357 
358 	TP_PROTO(journal_t *journal, blk_opf_t write_flags),
359 
360 	TP_ARGS(journal, write_flags),
361 
362 	TP_STRUCT__entry(
363 		__field(	dev_t,  dev			)
364 		__field(    blk_opf_t,  write_flags		)
365 	),
366 
367 	TP_fast_assign(
368 		__entry->dev		= journal->j_fs_dev->bd_dev;
369 		__entry->write_flags	= write_flags;
370 	),
371 
372 	TP_printk("dev %d,%d write_flags %x", MAJOR(__entry->dev),
373 		  MINOR(__entry->dev), (__force u32)__entry->write_flags)
374 );
375 
376 TRACE_EVENT(jbd2_lock_buffer_stall,
377 
378 	TP_PROTO(dev_t dev, unsigned long stall_ms),
379 
380 	TP_ARGS(dev, stall_ms),
381 
382 	TP_STRUCT__entry(
383 		__field(        dev_t, dev	)
384 		__field(unsigned long, stall_ms	)
385 	),
386 
387 	TP_fast_assign(
388 		__entry->dev		= dev;
389 		__entry->stall_ms	= stall_ms;
390 	),
391 
392 	TP_printk("dev %d,%d stall_ms %lu",
393 		MAJOR(__entry->dev), MINOR(__entry->dev),
394 		__entry->stall_ms)
395 );
396 
397 DECLARE_EVENT_CLASS(jbd2_journal_shrink,
398 
399 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan,
400 		 unsigned long count),
401 
402 	TP_ARGS(journal, nr_to_scan, count),
403 
404 	TP_STRUCT__entry(
405 		__field(dev_t, dev)
406 		__field(unsigned long, nr_to_scan)
407 		__field(unsigned long, count)
408 	),
409 
410 	TP_fast_assign(
411 		__entry->dev		= journal->j_fs_dev->bd_dev;
412 		__entry->nr_to_scan	= nr_to_scan;
413 		__entry->count		= count;
414 	),
415 
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)
419 );
420 
421 DEFINE_EVENT(jbd2_journal_shrink, jbd2_shrink_count,
422 
423 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan, unsigned long count),
424 
425 	TP_ARGS(journal, nr_to_scan, count)
426 );
427 
428 DEFINE_EVENT(jbd2_journal_shrink, jbd2_shrink_scan_enter,
429 
430 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan, unsigned long count),
431 
432 	TP_ARGS(journal, nr_to_scan, count)
433 );
434 
435 TRACE_EVENT(jbd2_shrink_scan_exit,
436 
437 	TP_PROTO(journal_t *journal, unsigned long nr_to_scan,
438 		 unsigned long nr_shrunk, unsigned long count),
439 
440 	TP_ARGS(journal, nr_to_scan, nr_shrunk, count),
441 
442 	TP_STRUCT__entry(
443 		__field(dev_t, dev)
444 		__field(unsigned long, nr_to_scan)
445 		__field(unsigned long, nr_shrunk)
446 		__field(unsigned long, count)
447 	),
448 
449 	TP_fast_assign(
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;
454 	),
455 
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,
459 		  __entry->count)
460 );
461 
462 TRACE_EVENT(jbd2_shrink_checkpoint_list,
463 
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),
466 
467 	TP_ARGS(journal, first_tid, tid, last_tid, nr_freed, next_tid),
468 
469 	TP_STRUCT__entry(
470 		__field(dev_t, dev)
471 		__field(tid_t, first_tid)
472 		__field(tid_t, tid)
473 		__field(tid_t, last_tid)
474 		__field(unsigned long, nr_freed)
475 		__field(tid_t, next_tid)
476 	),
477 
478 	TP_fast_assign(
479 		__entry->dev		= journal->j_fs_dev->bd_dev;
480 		__entry->first_tid	= first_tid;
481 		__entry->tid		= tid;
482 		__entry->last_tid	= last_tid;
483 		__entry->nr_freed	= nr_freed;
484 		__entry->next_tid	= next_tid;
485 	),
486 
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)
492 );
493 
494 #endif /* _TRACE_JBD2_H */
495 
496 /* This part must be outside protection */
497 #include <trace/define_trace.h>
498