1
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( int, 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 %d 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( int, transaction )
101 __field( int, 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 %d sync %d head %d",
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 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),
139
140 TP_ARGS(dev, tid, type, line_no, requested_blocks),
141
142 TP_STRUCT__entry(
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)
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 %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)
162 );
163
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),
168
169 TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),
170
171 TP_STRUCT__entry(
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)
178 ),
179
180 TP_fast_assign(
181 __entry->dev = dev;
182 __entry->tid = tid;
183 __entry->type = type;
184 __entry->line_no = line_no;
185 __entry->buffer_credits = buffer_credits;
186 __entry->requested_blocks = requested_blocks;
187 ),
188
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)
194 );
195
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),
200
201 TP_ARGS(dev, tid, type, line_no, interval, sync,
202 requested_blocks, dirtied_blocks),
203
204 TP_STRUCT__entry(
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 )
210 __field( int, sync )
211 __field( int, requested_blocks)
212 __field( int, dirtied_blocks )
213 ),
214
215 TP_fast_assign(
216 __entry->dev = dev;
217 __entry->tid = tid;
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;
224 ),
225
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)
232 );
233
234 TRACE_EVENT(jbd2_run_stats,
235 TP_PROTO(dev_t dev, unsigned long tid,
236 struct transaction_run_stats_s *stats),
237
238 TP_ARGS(dev, tid, stats),
239
240 TP_STRUCT__entry(
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 )
252 ),
253
254 TP_fast_assign(
255 __entry->dev = dev;
256 __entry->tid = tid;
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;
266 ),
267
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)
280 );
281
282 TRACE_EVENT(jbd2_checkpoint_stats,
283 TP_PROTO(dev_t dev, unsigned long tid,
284 struct transaction_chp_stats_s *stats),
285
286 TP_ARGS(dev, tid, stats),
287
288 TP_STRUCT__entry(
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 )
295 ),
296
297 TP_fast_assign(
298 __entry->dev = dev;
299 __entry->tid = tid;
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;
304 ),
305
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)
311 );
312
313 TRACE_EVENT(jbd2_update_log_tail,
314
315 TP_PROTO(journal_t *journal, tid_t first_tid,
316 unsigned long block_nr, unsigned long freed),
317
318 TP_ARGS(journal, first_tid, block_nr, freed),
319
320 TP_STRUCT__entry(
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 )
326 ),
327
328 TP_fast_assign(
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;
334 ),
335
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)
340 );
341
342 TRACE_EVENT(jbd2_write_superblock,
343
344 TP_PROTO(journal_t *journal, int write_op),
345
346 TP_ARGS(journal, write_op),
347
348 TP_STRUCT__entry(
349 __field( dev_t, dev )
350 __field( int, write_op )
351 ),
352
353 TP_fast_assign(
354 __entry->dev = journal->j_fs_dev->bd_dev;
355 __entry->write_op = write_op;
356 ),
357
358 TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
359 MINOR(__entry->dev), __entry->write_op)
360 );
361
362 TRACE_EVENT(jbd2_lock_buffer_stall,
363
364 TP_PROTO(dev_t dev, unsigned long stall_ms),
365
366 TP_ARGS(dev, stall_ms),
367
368 TP_STRUCT__entry(
369 __field( dev_t, dev )
370 __field(unsigned long, stall_ms )
371 ),
372
373 TP_fast_assign(
374 __entry->dev = dev;
375 __entry->stall_ms = stall_ms;
376 ),
377
378 TP_printk("dev %d,%d stall_ms %lu",
379 MAJOR(__entry->dev), MINOR(__entry->dev),
380 __entry->stall_ms)
381 );
382
383 #endif
384
385
386 #include <trace/define_trace.h>