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( int, 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 %d 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( int, transaction
)
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 %d sync %d head %d",
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 TRACE_EVENT(jbd2_handle_start
,
137 TP_PROTO(dev_t dev
, unsigned long 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( unsigned long, 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 %lu 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 TRACE_EVENT(jbd2_handle_extend
,
165 TP_PROTO(dev_t dev
, unsigned long tid
, unsigned int type
,
166 unsigned int line_no
, int buffer_credits
,
167 int requested_blocks
),
169 TP_ARGS(dev
, tid
, type
, line_no
, buffer_credits
, requested_blocks
),
172 __field( dev_t
, dev
)
173 __field( unsigned long, tid
)
174 __field( unsigned int, type
)
175 __field( unsigned int, line_no
)
176 __field( int, buffer_credits
)
177 __field( int, requested_blocks
)
183 __entry
->type
= type
;
184 __entry
->line_no
= line_no
;
185 __entry
->buffer_credits
= buffer_credits
;
186 __entry
->requested_blocks
= requested_blocks
;
189 TP_printk("dev %d,%d tid %lu type %u line_no %u "
190 "buffer_credits %d requested_blocks %d",
191 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->tid
,
192 __entry
->type
, __entry
->line_no
, __entry
->buffer_credits
,
193 __entry
->requested_blocks
)
196 TRACE_EVENT(jbd2_handle_stats
,
197 TP_PROTO(dev_t dev
, unsigned long tid
, unsigned int type
,
198 unsigned int line_no
, int interval
, int sync
,
199 int requested_blocks
, int dirtied_blocks
),
201 TP_ARGS(dev
, tid
, type
, line_no
, interval
, sync
,
202 requested_blocks
, dirtied_blocks
),
205 __field( dev_t
, dev
)
206 __field( unsigned long, tid
)
207 __field( unsigned int, type
)
208 __field( unsigned int, line_no
)
209 __field( int, interval
)
211 __field( int, requested_blocks
)
212 __field( int, dirtied_blocks
)
218 __entry
->type
= type
;
219 __entry
->line_no
= line_no
;
220 __entry
->interval
= interval
;
221 __entry
->sync
= sync
;
222 __entry
->requested_blocks
= requested_blocks
;
223 __entry
->dirtied_blocks
= dirtied_blocks
;
226 TP_printk("dev %d,%d tid %lu type %u line_no %u interval %d "
227 "sync %d requested_blocks %d dirtied_blocks %d",
228 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->tid
,
229 __entry
->type
, __entry
->line_no
, __entry
->interval
,
230 __entry
->sync
, __entry
->requested_blocks
,
231 __entry
->dirtied_blocks
)
234 TRACE_EVENT(jbd2_run_stats
,
235 TP_PROTO(dev_t dev
, unsigned long tid
,
236 struct transaction_run_stats_s
*stats
),
238 TP_ARGS(dev
, tid
, stats
),
241 __field( dev_t
, dev
)
242 __field( unsigned long, tid
)
243 __field( unsigned long, wait
)
244 __field( unsigned long, request_delay
)
245 __field( unsigned long, running
)
246 __field( unsigned long, locked
)
247 __field( unsigned long, flushing
)
248 __field( unsigned long, logging
)
249 __field( __u32
, handle_count
)
250 __field( __u32
, blocks
)
251 __field( __u32
, blocks_logged
)
257 __entry
->wait
= stats
->rs_wait
;
258 __entry
->request_delay
= stats
->rs_request_delay
;
259 __entry
->running
= stats
->rs_running
;
260 __entry
->locked
= stats
->rs_locked
;
261 __entry
->flushing
= stats
->rs_flushing
;
262 __entry
->logging
= stats
->rs_logging
;
263 __entry
->handle_count
= stats
->rs_handle_count
;
264 __entry
->blocks
= stats
->rs_blocks
;
265 __entry
->blocks_logged
= stats
->rs_blocks_logged
;
268 TP_printk("dev %d,%d tid %lu wait %u request_delay %u running %u "
269 "locked %u flushing %u logging %u handle_count %u "
270 "blocks %u blocks_logged %u",
271 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->tid
,
272 jiffies_to_msecs(__entry
->wait
),
273 jiffies_to_msecs(__entry
->request_delay
),
274 jiffies_to_msecs(__entry
->running
),
275 jiffies_to_msecs(__entry
->locked
),
276 jiffies_to_msecs(__entry
->flushing
),
277 jiffies_to_msecs(__entry
->logging
),
278 __entry
->handle_count
, __entry
->blocks
,
279 __entry
->blocks_logged
)
282 TRACE_EVENT(jbd2_checkpoint_stats
,
283 TP_PROTO(dev_t dev
, unsigned long tid
,
284 struct transaction_chp_stats_s
*stats
),
286 TP_ARGS(dev
, tid
, stats
),
289 __field( dev_t
, dev
)
290 __field( unsigned long, tid
)
291 __field( unsigned long, chp_time
)
292 __field( __u32
, forced_to_close
)
293 __field( __u32
, written
)
294 __field( __u32
, dropped
)
300 __entry
->chp_time
= stats
->cs_chp_time
;
301 __entry
->forced_to_close
= stats
->cs_forced_to_close
;
302 __entry
->written
= stats
->cs_written
;
303 __entry
->dropped
= stats
->cs_dropped
;
306 TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
307 "written %u dropped %u",
308 MAJOR(__entry
->dev
), MINOR(__entry
->dev
), __entry
->tid
,
309 jiffies_to_msecs(__entry
->chp_time
),
310 __entry
->forced_to_close
, __entry
->written
, __entry
->dropped
)
313 TRACE_EVENT(jbd2_update_log_tail
,
315 TP_PROTO(journal_t
*journal
, tid_t first_tid
,
316 unsigned long block_nr
, unsigned long freed
),
318 TP_ARGS(journal
, first_tid
, block_nr
, freed
),
321 __field( dev_t
, dev
)
322 __field( tid_t
, tail_sequence
)
323 __field( tid_t
, first_tid
)
324 __field(unsigned long, block_nr
)
325 __field(unsigned long, freed
)
329 __entry
->dev
= journal
->j_fs_dev
->bd_dev
;
330 __entry
->tail_sequence
= journal
->j_tail_sequence
;
331 __entry
->first_tid
= first_tid
;
332 __entry
->block_nr
= block_nr
;
333 __entry
->freed
= freed
;
336 TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
337 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
338 __entry
->tail_sequence
, __entry
->first_tid
,
339 __entry
->block_nr
, __entry
->freed
)
342 TRACE_EVENT(jbd2_write_superblock
,
344 TP_PROTO(journal_t
*journal
, int write_op
),
346 TP_ARGS(journal
, write_op
),
349 __field( dev_t
, dev
)
350 __field( int, write_op
)
354 __entry
->dev
= journal
->j_fs_dev
->bd_dev
;
355 __entry
->write_op
= write_op
;
358 TP_printk("dev %d,%d write_op %x", MAJOR(__entry
->dev
),
359 MINOR(__entry
->dev
), __entry
->write_op
)
362 TRACE_EVENT(jbd2_lock_buffer_stall
,
364 TP_PROTO(dev_t dev
, unsigned long stall_ms
),
366 TP_ARGS(dev
, stall_ms
),
369 __field( dev_t
, dev
)
370 __field(unsigned long, stall_ms
)
375 __entry
->stall_ms
= stall_ms
;
378 TP_printk("dev %d,%d stall_ms %lu",
379 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
383 #endif /* _TRACE_JBD2_H */
385 /* This part must be outside protection */
386 #include <trace/define_trace.h>