xref: /openbmc/linux/include/trace/events/jbd2.h (revision 4800cd83)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM jbd2
3 
4 #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 
10 struct transaction_chp_stats_s;
11 struct transaction_run_stats_s;
12 
13 TRACE_EVENT(jbd2_checkpoint,
14 
15 	TP_PROTO(journal_t *journal, int result),
16 
17 	TP_ARGS(journal, result),
18 
19 	TP_STRUCT__entry(
20 		__field(	int,	dev_major		)
21 		__field(	int,	dev_minor		)
22 		__field(	int,	result			)
23 	),
24 
25 	TP_fast_assign(
26 		__entry->dev_major	= MAJOR(journal->j_fs_dev->bd_dev);
27 		__entry->dev_minor	= MINOR(journal->j_fs_dev->bd_dev);
28 		__entry->result		= result;
29 	),
30 
31 	TP_printk("dev %d,%d result %d",
32 		  __entry->dev_major, __entry->dev_minor, __entry->result)
33 );
34 
35 DECLARE_EVENT_CLASS(jbd2_commit,
36 
37 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
38 
39 	TP_ARGS(journal, commit_transaction),
40 
41 	TP_STRUCT__entry(
42 		__field(	int,   dev_major                )
43 		__field(	int,   dev_minor                )
44 		__field(	char,	sync_commit		  )
45 		__field(	int,	transaction		  )
46 	),
47 
48 	TP_fast_assign(
49 		__entry->dev_major	= MAJOR(journal->j_fs_dev->bd_dev);
50 		__entry->dev_minor	= MINOR(journal->j_fs_dev->bd_dev);
51 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
52 		__entry->transaction	= commit_transaction->t_tid;
53 	),
54 
55 	TP_printk("dev %d,%d transaction %d sync %d",
56 		  __entry->dev_major, __entry->dev_minor,
57 		  __entry->transaction, __entry->sync_commit)
58 );
59 
60 DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
61 
62 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
63 
64 	TP_ARGS(journal, commit_transaction)
65 );
66 
67 DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
68 
69 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
70 
71 	TP_ARGS(journal, commit_transaction)
72 );
73 
74 DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
75 
76 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
77 
78 	TP_ARGS(journal, commit_transaction)
79 );
80 
81 DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
82 
83 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
84 
85 	TP_ARGS(journal, commit_transaction)
86 );
87 
88 TRACE_EVENT(jbd2_end_commit,
89 	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
90 
91 	TP_ARGS(journal, commit_transaction),
92 
93 	TP_STRUCT__entry(
94 		__field(	int,   dev_major                )
95 		__field(	int,   dev_minor                )
96 		__field(	char,	sync_commit		  )
97 		__field(	int,	transaction		  )
98 		__field(	int,	head		  	  )
99 	),
100 
101 	TP_fast_assign(
102 		__entry->dev_major	= MAJOR(journal->j_fs_dev->bd_dev);
103 		__entry->dev_minor	= MINOR(journal->j_fs_dev->bd_dev);
104 		__entry->sync_commit = commit_transaction->t_synchronous_commit;
105 		__entry->transaction	= commit_transaction->t_tid;
106 		__entry->head		= journal->j_tail_sequence;
107 	),
108 
109 	TP_printk("dev %d,%d transaction %d sync %d head %d",
110 		  __entry->dev_major, __entry->dev_minor,
111 		  __entry->transaction, __entry->sync_commit, __entry->head)
112 );
113 
114 TRACE_EVENT(jbd2_submit_inode_data,
115 	TP_PROTO(struct inode *inode),
116 
117 	TP_ARGS(inode),
118 
119 	TP_STRUCT__entry(
120 		__field(	int,   dev_major                )
121 		__field(	int,   dev_minor                )
122 		__field(	ino_t,	ino			)
123 	),
124 
125 	TP_fast_assign(
126 		__entry->dev_major = MAJOR(inode->i_sb->s_dev);
127 		__entry->dev_minor = MINOR(inode->i_sb->s_dev);
128 		__entry->ino	= inode->i_ino;
129 	),
130 
131 	TP_printk("dev %d,%d ino %lu",
132 		  __entry->dev_major, __entry->dev_minor,
133 		  (unsigned long) __entry->ino)
134 );
135 
136 TRACE_EVENT(jbd2_run_stats,
137 	TP_PROTO(dev_t dev, unsigned long tid,
138 		 struct transaction_run_stats_s *stats),
139 
140 	TP_ARGS(dev, tid, stats),
141 
142 	TP_STRUCT__entry(
143 		__field(		  int,	dev_major	)
144 		__field(		  int,	dev_minor	)
145 		__field(	unsigned long,	tid		)
146 		__field(	unsigned long,	wait		)
147 		__field(	unsigned long,	running		)
148 		__field(	unsigned long,	locked		)
149 		__field(	unsigned long,	flushing	)
150 		__field(	unsigned long,	logging		)
151 		__field(		__u32,	handle_count	)
152 		__field(		__u32,	blocks		)
153 		__field(		__u32,	blocks_logged	)
154 	),
155 
156 	TP_fast_assign(
157 		__entry->dev_major	= MAJOR(dev);
158 		__entry->dev_minor	= MINOR(dev);
159 		__entry->tid		= tid;
160 		__entry->wait		= stats->rs_wait;
161 		__entry->running	= stats->rs_running;
162 		__entry->locked		= stats->rs_locked;
163 		__entry->flushing	= stats->rs_flushing;
164 		__entry->logging	= stats->rs_logging;
165 		__entry->handle_count	= stats->rs_handle_count;
166 		__entry->blocks		= stats->rs_blocks;
167 		__entry->blocks_logged	= stats->rs_blocks_logged;
168 	),
169 
170 	TP_printk("dev %d,%d tid %lu wait %u running %u locked %u flushing %u "
171 		  "logging %u handle_count %u blocks %u blocks_logged %u",
172 		  __entry->dev_major, __entry->dev_minor, __entry->tid,
173 		  jiffies_to_msecs(__entry->wait),
174 		  jiffies_to_msecs(__entry->running),
175 		  jiffies_to_msecs(__entry->locked),
176 		  jiffies_to_msecs(__entry->flushing),
177 		  jiffies_to_msecs(__entry->logging),
178 		  __entry->handle_count, __entry->blocks,
179 		  __entry->blocks_logged)
180 );
181 
182 TRACE_EVENT(jbd2_checkpoint_stats,
183 	TP_PROTO(dev_t dev, unsigned long tid,
184 		 struct transaction_chp_stats_s *stats),
185 
186 	TP_ARGS(dev, tid, stats),
187 
188 	TP_STRUCT__entry(
189 		__field(		  int,	dev_major	)
190 		__field(		  int,	dev_minor	)
191 		__field(	unsigned long,	tid		)
192 		__field(	unsigned long,	chp_time	)
193 		__field(		__u32,	forced_to_close	)
194 		__field(		__u32,	written		)
195 		__field(		__u32,	dropped		)
196 	),
197 
198 	TP_fast_assign(
199 		__entry->dev_major	= MAJOR(dev);
200 		__entry->dev_minor	= MINOR(dev);
201 		__entry->tid		= tid;
202 		__entry->chp_time	= stats->cs_chp_time;
203 		__entry->forced_to_close= stats->cs_forced_to_close;
204 		__entry->written	= stats->cs_written;
205 		__entry->dropped	= stats->cs_dropped;
206 	),
207 
208 	TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
209 		  "written %u dropped %u",
210 		  __entry->dev_major, __entry->dev_minor, __entry->tid,
211 		  jiffies_to_msecs(__entry->chp_time),
212 		  __entry->forced_to_close, __entry->written, __entry->dropped)
213 );
214 
215 TRACE_EVENT(jbd2_cleanup_journal_tail,
216 
217 	TP_PROTO(journal_t *journal, tid_t first_tid,
218 		 unsigned long block_nr, unsigned long freed),
219 
220 	TP_ARGS(journal, first_tid, block_nr, freed),
221 
222 	TP_STRUCT__entry(
223 		__field(	int,   dev_major                )
224 		__field(	int,   dev_minor                )
225 		__field(	tid_t,	tail_sequence		)
226 		__field(	tid_t,	first_tid		)
227 		__field(unsigned long,	block_nr		)
228 		__field(unsigned long,	freed			)
229 	),
230 
231 	TP_fast_assign(
232 		__entry->dev_major	= MAJOR(journal->j_fs_dev->bd_dev);
233 		__entry->dev_minor	= MINOR(journal->j_fs_dev->bd_dev);
234 		__entry->tail_sequence	= journal->j_tail_sequence;
235 		__entry->first_tid	= first_tid;
236 		__entry->block_nr	= block_nr;
237 		__entry->freed		= freed;
238 	),
239 
240 	TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
241 		  __entry->dev_major, __entry->dev_minor,
242 		  __entry->tail_sequence, __entry->first_tid,
243 		  __entry->block_nr, __entry->freed)
244 );
245 
246 #endif /* _TRACE_JBD2_H */
247 
248 /* This part must be outside protection */
249 #include <trace/define_trace.h>
250