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