Commit | Line | Data |
---|---|---|
b87700e3 AG |
1 | #undef TRACE_SYSTEM |
2 | #define TRACE_SYSTEM writeback | |
3 | ||
3bc29f0a MD |
4 | #if !defined(LTTNG_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) |
5 | #define LTTNG_TRACE_WRITEBACK_H | |
b87700e3 | 6 | |
3bc29f0a | 7 | #include "../../../probes/lttng-tracepoint-event.h" |
aa634cd1 | 8 | #include <linux/tracepoint.h> |
b87700e3 AG |
9 | #include <linux/backing-dev.h> |
10 | #include <linux/writeback.h> | |
11 | #include <linux/version.h> | |
12 | ||
13 | #ifndef _TRACE_WRITEBACK_DEF_ | |
14 | #define _TRACE_WRITEBACK_DEF_ | |
99a570c8 MD |
15 | |
16 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) | |
b87700e3 AG |
17 | static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) |
18 | { | |
19 | struct super_block *sb = inode->i_sb; | |
20 | ||
21 | if (strcmp(sb->s_type->name, "bdev") == 0) | |
22 | return inode->i_mapping->backing_dev_info; | |
23 | ||
24 | return sb->s_bdi; | |
25 | } | |
99a570c8 MD |
26 | #endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)) */ |
27 | ||
b87700e3 AG |
28 | #endif |
29 | ||
99a570c8 MD |
30 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) |
31 | #define show_inode_state(state) \ | |
32 | __print_flags(state, "|", \ | |
33 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ | |
34 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ | |
35 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ | |
36 | {I_NEW, "I_NEW"}, \ | |
37 | {I_WILL_FREE, "I_WILL_FREE"}, \ | |
38 | {I_FREEING, "I_FREEING"}, \ | |
39 | {I_CLEAR, "I_CLEAR"}, \ | |
40 | {I_SYNC, "I_SYNC"}, \ | |
41 | {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ | |
42 | {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \ | |
43 | {I_REFERENCED, "I_REFERENCED"} \ | |
44 | ) | |
45 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */ | |
b87700e3 AG |
46 | #define show_inode_state(state) \ |
47 | __print_flags(state, "|", \ | |
48 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ | |
49 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ | |
50 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ | |
51 | {I_NEW, "I_NEW"}, \ | |
52 | {I_WILL_FREE, "I_WILL_FREE"}, \ | |
53 | {I_FREEING, "I_FREEING"}, \ | |
54 | {I_CLEAR, "I_CLEAR"}, \ | |
55 | {I_SYNC, "I_SYNC"}, \ | |
56 | {I_REFERENCED, "I_REFERENCED"} \ | |
57 | ) | |
99a570c8 | 58 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */ |
b87700e3 | 59 | |
99a570c8 MD |
60 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) |
61 | ||
62 | LTTNG_TRACEPOINT_EVENT(writeback_dirty_page, | |
63 | TP_PROTO(struct page *page, struct address_space *mapping), | |
64 | TP_ARGS(page, mapping), | |
f127e61e MD |
65 | TP_FIELDS( |
66 | ctf_array_text(char, name, | |
99a570c8 | 67 | mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32) |
f127e61e MD |
68 | ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0) |
69 | ctf_integer(pgoff_t, index, page->index) | |
99a570c8 MD |
70 | ) |
71 | ) | |
72 | ||
73 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template, | |
74 | TP_PROTO(struct inode *inode, int flags), | |
75 | TP_ARGS(inode, flags), | |
f127e61e | 76 | TP_FIELDS( |
99a570c8 | 77 | /* may be called for files on pseudo FSes w/ unregistered bdi */ |
f127e61e | 78 | ctf_array_text(char, name, |
99a570c8 MD |
79 | inode_to_bdi(inode)->dev ? |
80 | dev_name(inode_to_bdi(inode)->dev) : "(unknown)", 32) | |
f127e61e MD |
81 | ctf_integer(unsigned long, ino, inode->i_ino) |
82 | ctf_integer(unsigned long, state, inode->i_state) | |
83 | ctf_integer(unsigned long, flags, flags) | |
99a570c8 MD |
84 | ) |
85 | ) | |
86 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \ | |
87 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \ | |
88 | TP_PROTO(struct inode *inode, int flags), \ | |
89 | TP_ARGS(inode, flags)) | |
90 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start) | |
91 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode) | |
92 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_mark_inode_dirty) | |
93 | ||
94 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template, | |
95 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), | |
96 | TP_ARGS(inode, wbc), | |
f127e61e MD |
97 | TP_FIELDS( |
98 | ctf_array_text(char, name, | |
99a570c8 | 99 | dev_name(inode_to_bdi(inode)->dev), 32) |
f127e61e MD |
100 | ctf_integer(unsigned long, ino, inode->i_ino) |
101 | ctf_integer(int, sync_mode, wbc->sync_mode) | |
99a570c8 MD |
102 | ) |
103 | ) | |
104 | ||
105 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \ | |
106 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \ | |
107 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), \ | |
108 | TP_ARGS(inode, wbc)) | |
109 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start) | |
110 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode) | |
111 | ||
112 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) | |
113 | ||
aa634cd1 JD |
114 | LTTNG_TRACEPOINT_EVENT(writeback_dirty_page, |
115 | TP_PROTO(struct page *page, struct address_space *mapping), | |
116 | TP_ARGS(page, mapping), | |
f127e61e MD |
117 | TP_FIELDS( |
118 | ctf_array_text(char, name, | |
aa634cd1 | 119 | mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32) |
f127e61e MD |
120 | ctf_integer(unsigned long, ino, mapping ? mapping->host->i_ino : 0) |
121 | ctf_integer(pgoff_t, index, page->index) | |
aa634cd1 JD |
122 | ) |
123 | ) | |
124 | ||
125 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_dirty_inode_template, | |
126 | TP_PROTO(struct inode *inode, int flags), | |
127 | TP_ARGS(inode, flags), | |
f127e61e | 128 | TP_FIELDS( |
aa634cd1 | 129 | /* may be called for files on pseudo FSes w/ unregistered bdi */ |
f127e61e | 130 | ctf_array_text(char, name, |
aa634cd1 | 131 | inode->i_mapping->backing_dev_info->dev ? |
f127e61e MD |
132 | dev_name(inode->i_mapping->backing_dev_info->dev) |
133 | : "(unknown)", 32) | |
134 | ctf_integer(unsigned long, ino, inode->i_ino) | |
135 | ctf_integer(unsigned long, flags, flags) | |
aa634cd1 JD |
136 | ) |
137 | ) | |
138 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(name) \ | |
139 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_dirty_inode_template, name, \ | |
140 | TP_PROTO(struct inode *inode, int flags), \ | |
141 | TP_ARGS(inode, flags)) | |
142 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode_start) | |
143 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_DIRTY_INODE_TEMPLATE(writeback_dirty_inode) | |
144 | ||
145 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_write_inode_template, | |
146 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), | |
147 | TP_ARGS(inode, wbc), | |
f127e61e MD |
148 | TP_FIELDS( |
149 | ctf_array_text(char, name, | |
aa634cd1 | 150 | dev_name(inode->i_mapping->backing_dev_info->dev), 32) |
f127e61e MD |
151 | ctf_integer(unsigned long, ino, inode->i_ino) |
152 | ctf_integer(int, sync_mode, wbc->sync_mode) | |
aa634cd1 JD |
153 | ) |
154 | ) | |
155 | ||
156 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(name) \ | |
157 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_write_inode_template, name, \ | |
158 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), \ | |
159 | TP_ARGS(inode, wbc)) | |
160 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode_start) | |
161 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WRITE_INODE(writeback_write_inode) | |
99a570c8 | 162 | |
aa634cd1 JD |
163 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) */ |
164 | ||
6ecb6b25 MD |
165 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) |
166 | ||
167 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, | |
168 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), | |
169 | TP_ARGS(wb, work), | |
170 | TP_FIELDS( | |
171 | ctf_array_text(char, name, wb->bdi->dev ? dev_name(wb->bdi->dev) : | |
172 | "(unknown)", 32) | |
173 | ) | |
174 | ) | |
175 | ||
176 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) | |
99a570c8 MD |
177 | |
178 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, | |
179 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), | |
180 | TP_ARGS(bdi, work), | |
f127e61e MD |
181 | TP_FIELDS( |
182 | ctf_array_text(char, name, bdi->dev ? dev_name(bdi->dev) : | |
99a570c8 | 183 | "(unknown)", 32) |
99a570c8 MD |
184 | ) |
185 | ) | |
186 | ||
187 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */ | |
188 | ||
3bc29f0a | 189 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, |
b87700e3 AG |
190 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), |
191 | TP_ARGS(bdi, work), | |
f127e61e MD |
192 | TP_FIELDS( |
193 | ctf_array_text(char, name, | |
194 | dev_name(bdi->dev ? bdi->dev : | |
b87700e3 | 195 | default_backing_dev_info.dev), 32) |
b87700e3 | 196 | ) |
b87700e3 | 197 | ) |
99a570c8 MD |
198 | |
199 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */ | |
200 | ||
6ecb6b25 MD |
201 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) |
202 | ||
203 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \ | |
204 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \ | |
205 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \ | |
206 | TP_ARGS(wb, work)) | |
207 | ||
208 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ | |
209 | ||
3bc29f0a MD |
210 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \ |
211 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \ | |
b87700e3 AG |
212 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ |
213 | TP_ARGS(bdi, work)) | |
6ecb6b25 MD |
214 | |
215 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ | |
216 | ||
3bc29f0a MD |
217 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread) |
218 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue) | |
219 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec) | |
b87700e3 | 220 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) |
3bc29f0a MD |
221 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start) |
222 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written) | |
223 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait) | |
b87700e3 AG |
224 | #endif |
225 | ||
3bc29f0a | 226 | LTTNG_TRACEPOINT_EVENT(writeback_pages_written, |
b87700e3 AG |
227 | TP_PROTO(long pages_written), |
228 | TP_ARGS(pages_written), | |
f127e61e MD |
229 | TP_FIELDS( |
230 | ctf_integer(long, pages, pages_written) | |
231 | ) | |
b87700e3 AG |
232 | ) |
233 | ||
6ecb6b25 MD |
234 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) |
235 | ||
236 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class, | |
237 | TP_PROTO(struct bdi_writeback *wb), | |
238 | TP_ARGS(wb), | |
239 | TP_FIELDS( | |
240 | ctf_array_text(char, name, | |
241 | dev_name(wb->bdi->dev), 32) | |
242 | ) | |
243 | ) | |
244 | ||
245 | #undef DEFINE_WRITEBACK_EVENT | |
246 | #define DEFINE_WRITEBACK_EVENT(name) \ | |
247 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \ | |
248 | TP_PROTO(struct bdi_writeback *wb), \ | |
249 | TP_ARGS(wb)) | |
250 | ||
251 | #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \ | |
252 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \ | |
253 | TP_PROTO(struct bdi_writeback *wb), \ | |
254 | TP_ARGS(wb)) | |
255 | ||
256 | LTTNG_TRACEPOINT_EVENT(writeback_bdi_register, | |
257 | TP_PROTO(struct backing_dev_info *bdi), | |
258 | TP_ARGS(bdi), | |
259 | TP_FIELDS( | |
260 | ctf_array_text(char, name, | |
261 | dev_name(bdi->dev), 32) | |
262 | ) | |
263 | ) | |
264 | ||
265 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ | |
266 | ||
3bc29f0a | 267 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class, |
b87700e3 AG |
268 | TP_PROTO(struct backing_dev_info *bdi), |
269 | TP_ARGS(bdi), | |
f127e61e MD |
270 | TP_FIELDS( |
271 | ctf_array_text(char, name, | |
272 | dev_name(bdi->dev), 32) | |
b87700e3 AG |
273 | ) |
274 | ) | |
6ecb6b25 | 275 | |
59fecd6c | 276 | #undef DEFINE_WRITEBACK_EVENT |
b87700e3 | 277 | #define DEFINE_WRITEBACK_EVENT(name) \ |
3bc29f0a | 278 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \ |
b87700e3 AG |
279 | TP_PROTO(struct backing_dev_info *bdi), \ |
280 | TP_ARGS(bdi)) | |
281 | ||
9cf29d3e | 282 | #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \ |
3bc29f0a | 283 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \ |
9cf29d3e MD |
284 | TP_PROTO(struct backing_dev_info *bdi), \ |
285 | TP_ARGS(bdi)) | |
286 | ||
6ecb6b25 MD |
287 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register) |
288 | ||
289 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ | |
290 | ||
b87700e3 AG |
291 | DEFINE_WRITEBACK_EVENT(writeback_nowork) |
292 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) | |
293 | DEFINE_WRITEBACK_EVENT(writeback_wake_background) | |
294 | #endif | |
295 | DEFINE_WRITEBACK_EVENT(writeback_wake_thread) | |
296 | DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread) | |
b87700e3 AG |
297 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister) |
298 | DEFINE_WRITEBACK_EVENT(writeback_thread_start) | |
299 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop) | |
300 | #if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0)) | |
9cf29d3e MD |
301 | DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start) |
302 | DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait) | |
303 | ||
3bc29f0a | 304 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written, |
b87700e3 | 305 | |
9cf29d3e | 306 | writeback_balance_dirty_written, |
b87700e3 AG |
307 | |
308 | TP_PROTO(struct backing_dev_info *bdi, int written), | |
309 | ||
310 | TP_ARGS(bdi, written), | |
311 | ||
f127e61e MD |
312 | TP_FIELDS( |
313 | ctf_array_text(char, name, dev_name(bdi->dev), 32) | |
314 | ctf_integer(int, written, written) | |
b87700e3 AG |
315 | ) |
316 | ) | |
317 | #endif | |
318 | ||
3bc29f0a | 319 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class, |
b87700e3 AG |
320 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
321 | TP_ARGS(wbc, bdi), | |
f127e61e MD |
322 | TP_FIELDS( |
323 | ctf_array_text(char, name, dev_name(bdi->dev), 32) | |
324 | ctf_integer(long, nr_to_write, wbc->nr_to_write) | |
325 | ctf_integer(long, pages_skipped, wbc->pages_skipped) | |
326 | ctf_integer(int, sync_mode, wbc->sync_mode) | |
327 | ctf_integer(int, for_kupdate, wbc->for_kupdate) | |
328 | ctf_integer(int, for_background, wbc->for_background) | |
329 | ctf_integer(int, for_reclaim, wbc->for_reclaim) | |
330 | ctf_integer(int, range_cyclic, wbc->range_cyclic) | |
b87700e3 | 331 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) |
f127e61e MD |
332 | ctf_integer(int, more_io, wbc->more_io) |
333 | ctf_integer(unsigned long, older_than_this, | |
334 | wbc->older_than_this ? *wbc->older_than_this : 0) | |
b87700e3 | 335 | #endif |
f127e61e MD |
336 | ctf_integer(long, range_start, (long) wbc->range_start) |
337 | ctf_integer(long, range_end, (long) wbc->range_end) | |
338 | ) | |
b87700e3 AG |
339 | ) |
340 | ||
9cf29d3e | 341 | #undef DEFINE_WBC_EVENT |
3bc29f0a MD |
342 | #define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \ |
343 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \ | |
b87700e3 AG |
344 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
345 | TP_ARGS(wbc, bdi)) | |
346 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) | |
3bc29f0a MD |
347 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start) |
348 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written) | |
349 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait) | |
350 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start) | |
351 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written) | |
352 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait) | |
b87700e3 | 353 | #endif |
3bc29f0a | 354 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage) |
b87700e3 AG |
355 | |
356 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) | |
3bc29f0a | 357 | LTTNG_TRACEPOINT_EVENT(writeback_queue_io, |
b87700e3 AG |
358 | TP_PROTO(struct bdi_writeback *wb, |
359 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) | |
360 | struct wb_writeback_work *work, | |
361 | #else | |
362 | unsigned long *older_than_this, | |
363 | #endif | |
364 | int moved), | |
365 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) | |
366 | TP_ARGS(wb, work, moved), | |
367 | #else | |
368 | TP_ARGS(wb, older_than_this, moved), | |
369 | #endif | |
f127e61e MD |
370 | TP_FIELDS( |
371 | ctf_array_text(char, name, dev_name(wb->bdi->dev), 32) | |
b87700e3 | 372 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) |
b87700e3 | 373 | #else |
f127e61e MD |
374 | ctf_integer(unsigned long, older, |
375 | older_than_this ? *older_than_this : 0) | |
376 | ctf_integer(long, age, | |
377 | older_than_this ? | |
378 | (jiffies - *older_than_this) * 1000 / HZ | |
379 | : -1) | |
b87700e3 | 380 | #endif |
f127e61e | 381 | ctf_integer(int, moved, moved) |
b87700e3 | 382 | ) |
b87700e3 AG |
383 | ) |
384 | ||
3bc29f0a | 385 | LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, |
9cf29d3e MD |
386 | |
387 | writeback_global_dirty_state, | |
b87700e3 AG |
388 | |
389 | TP_PROTO(unsigned long background_thresh, | |
390 | unsigned long dirty_thresh | |
391 | ), | |
392 | ||
393 | TP_ARGS(background_thresh, | |
394 | dirty_thresh | |
395 | ), | |
396 | ||
f127e61e MD |
397 | TP_FIELDS( |
398 | ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY)) | |
399 | ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK)) | |
400 | ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS)) | |
401 | ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED)) | |
402 | ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN)) | |
403 | ctf_integer(unsigned long, background_thresh, background_thresh) | |
404 | ctf_integer(unsigned long, dirty_thresh, dirty_thresh) | |
405 | ctf_integer(unsigned long, dirty_limit, global_dirty_limit) | |
b87700e3 AG |
406 | ) |
407 | ) | |
408 | #endif | |
409 | ||
410 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) | |
411 | ||
412 | #define KBps(x) ((x) << (PAGE_SHIFT - 10)) | |
413 | ||
6ecb6b25 MD |
414 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) |
415 | ||
416 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, | |
417 | ||
418 | writeback_bdi_dirty_ratelimit, | |
419 | ||
420 | TP_PROTO(struct bdi_writeback *wb, | |
421 | unsigned long dirty_rate, | |
422 | unsigned long task_ratelimit), | |
423 | ||
424 | TP_ARGS(wb, dirty_rate, task_ratelimit), | |
425 | ||
426 | TP_FIELDS( | |
427 | ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32) | |
428 | ctf_integer(unsigned long, write_bw, KBps(wb->bdi->wb.write_bandwidth)) | |
429 | ctf_integer(unsigned long, avg_write_bw, KBps(wb->bdi->wb.avg_write_bandwidth)) | |
430 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) | |
431 | ctf_integer(unsigned long, dirty_ratelimit, KBps(wb->bdi->wb.dirty_ratelimit)) | |
432 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) | |
433 | ctf_integer(unsigned long, balanced_dirty_ratelimit, | |
434 | KBps(wb->bdi->wb.balanced_dirty_ratelimit)) | |
435 | ) | |
436 | ) | |
437 | ||
438 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) | |
d2a1666f | 439 | |
3bc29f0a | 440 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, |
9cf29d3e MD |
441 | |
442 | writeback_bdi_dirty_ratelimit, | |
b87700e3 AG |
443 | |
444 | TP_PROTO(struct backing_dev_info *bdi, | |
445 | unsigned long dirty_rate, | |
446 | unsigned long task_ratelimit), | |
447 | ||
448 | TP_ARGS(bdi, dirty_rate, task_ratelimit), | |
449 | ||
f127e61e MD |
450 | TP_FIELDS( |
451 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
9f305a2c MJ |
452 | ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth)) |
453 | ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth)) | |
f127e61e | 454 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) |
9f305a2c | 455 | ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit)) |
f127e61e | 456 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) |
9f305a2c MJ |
457 | ctf_integer(unsigned long, balanced_dirty_ratelimit, |
458 | KBps(bdi->wb.balanced_dirty_ratelimit)) | |
d2a1666f MD |
459 | ) |
460 | ) | |
461 | ||
462 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */ | |
463 | ||
464 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, | |
465 | ||
466 | writeback_bdi_dirty_ratelimit, | |
467 | ||
468 | TP_PROTO(struct backing_dev_info *bdi, | |
469 | unsigned long dirty_rate, | |
470 | unsigned long task_ratelimit), | |
471 | ||
472 | TP_ARGS(bdi, dirty_rate, task_ratelimit), | |
473 | ||
474 | TP_FIELDS( | |
475 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
476 | ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth)) | |
477 | ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth)) | |
478 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) | |
479 | ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit)) | |
480 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) | |
f127e61e | 481 | ctf_integer(unsigned long, balanced_dirty_ratelimit, |
b87700e3 | 482 | KBps(bdi->balanced_dirty_ratelimit)) |
b87700e3 AG |
483 | ) |
484 | ) | |
485 | ||
d2a1666f MD |
486 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */ |
487 | ||
6ecb6b25 MD |
488 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) |
489 | ||
490 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, | |
491 | ||
492 | writeback_balance_dirty_pages, | |
493 | ||
494 | TP_PROTO(struct bdi_writeback *wb, | |
495 | unsigned long thresh, | |
496 | unsigned long bg_thresh, | |
497 | unsigned long dirty, | |
498 | unsigned long bdi_thresh, | |
499 | unsigned long bdi_dirty, | |
500 | unsigned long dirty_ratelimit, | |
501 | unsigned long task_ratelimit, | |
502 | unsigned long dirtied, | |
503 | unsigned long period, | |
504 | long pause, | |
505 | unsigned long start_time), | |
506 | ||
507 | TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, | |
508 | dirty_ratelimit, task_ratelimit, | |
509 | dirtied, period, pause, start_time | |
510 | ), | |
511 | ||
512 | TP_FIELDS( | |
513 | ctf_array_text(char, bdi, dev_name(wb->bdi->dev), 32) | |
514 | ctf_integer(unsigned long, limit, global_dirty_limit) | |
515 | ctf_integer(unsigned long, setpoint, | |
516 | (global_dirty_limit + (thresh + bg_thresh) / 2) / 2) | |
517 | ctf_integer(unsigned long, dirty, dirty) | |
518 | ctf_integer(unsigned long, bdi_setpoint, | |
519 | ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) * | |
520 | bdi_thresh / (thresh + 1)) | |
521 | ctf_integer(unsigned long, bdi_dirty, bdi_dirty) | |
522 | ctf_integer(unsigned long, dirty_ratelimit, | |
523 | KBps(dirty_ratelimit)) | |
524 | ctf_integer(unsigned long, task_ratelimit, | |
525 | KBps(task_ratelimit)) | |
526 | ctf_integer(unsigned int, dirtied, dirtied) | |
527 | ctf_integer(unsigned int, dirtied_pause, | |
528 | current->nr_dirtied_pause) | |
529 | ctf_integer(unsigned long, paused, | |
530 | (jiffies - start_time) * 1000 / HZ) | |
531 | ctf_integer(long, pause, pause * 1000 / HZ) | |
532 | ctf_integer(unsigned long, period, | |
533 | period * 1000 / HZ) | |
534 | ctf_integer(long, think, | |
535 | current->dirty_paused_when == 0 ? 0 : | |
536 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ) | |
537 | ) | |
538 | ) | |
539 | ||
540 | #else /* #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ | |
541 | ||
3bc29f0a | 542 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, |
9cf29d3e MD |
543 | |
544 | writeback_balance_dirty_pages, | |
b87700e3 AG |
545 | |
546 | TP_PROTO(struct backing_dev_info *bdi, | |
547 | unsigned long thresh, | |
548 | unsigned long bg_thresh, | |
549 | unsigned long dirty, | |
550 | unsigned long bdi_thresh, | |
551 | unsigned long bdi_dirty, | |
552 | unsigned long dirty_ratelimit, | |
553 | unsigned long task_ratelimit, | |
554 | unsigned long dirtied, | |
555 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
556 | unsigned long period, | |
557 | #endif | |
558 | long pause, | |
559 | unsigned long start_time), | |
560 | ||
561 | TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, | |
562 | dirty_ratelimit, task_ratelimit, | |
563 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
f127e61e | 564 | dirtied, period, pause, start_time |
b87700e3 | 565 | #else |
f127e61e | 566 | dirtied, pause, start_time |
b87700e3 AG |
567 | #endif |
568 | ), | |
569 | ||
f127e61e MD |
570 | TP_FIELDS( |
571 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
572 | ctf_integer(unsigned long, limit, global_dirty_limit) | |
573 | ctf_integer(unsigned long, setpoint, | |
b87700e3 | 574 | (global_dirty_limit + (thresh + bg_thresh) / 2) / 2) |
f127e61e MD |
575 | ctf_integer(unsigned long, dirty, dirty) |
576 | ctf_integer(unsigned long, bdi_setpoint, | |
b87700e3 | 577 | ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) * |
f127e61e MD |
578 | bdi_thresh / (thresh + 1)) |
579 | ctf_integer(unsigned long, bdi_dirty, bdi_dirty) | |
580 | ctf_integer(unsigned long, dirty_ratelimit, | |
581 | KBps(dirty_ratelimit)) | |
582 | ctf_integer(unsigned long, task_ratelimit, | |
583 | KBps(task_ratelimit)) | |
584 | ctf_integer(unsigned int, dirtied, dirtied) | |
585 | ctf_integer(unsigned int, dirtied_pause, | |
586 | current->nr_dirtied_pause) | |
587 | ctf_integer(unsigned long, paused, | |
588 | (jiffies - start_time) * 1000 / HZ) | |
589 | ctf_integer(long, pause, pause * 1000 / HZ) | |
b87700e3 | 590 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
f127e61e MD |
591 | ctf_integer(unsigned long, period, |
592 | period * 1000 / HZ) | |
593 | ctf_integer(long, think, | |
594 | current->dirty_paused_when == 0 ? 0 : | |
595 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ) | |
b87700e3 | 596 | #endif |
f127e61e | 597 | ) |
b87700e3 | 598 | ) |
6ecb6b25 MD |
599 | #endif /* #else #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,3,0)) */ |
600 | ||
601 | #endif /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */ | |
b87700e3 AG |
602 | |
603 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 604 | LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue, |
b87700e3 AG |
605 | |
606 | TP_PROTO(struct inode *inode), | |
607 | TP_ARGS(inode), | |
608 | ||
f127e61e MD |
609 | TP_FIELDS( |
610 | ctf_array_text(char, name, | |
611 | dev_name(inode_to_bdi(inode)->dev), 32) | |
612 | ctf_integer(unsigned long, ino, inode->i_ino) | |
613 | ctf_integer(unsigned long, state, inode->i_state) | |
614 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) | |
b87700e3 AG |
615 | ) |
616 | ) | |
617 | #endif | |
618 | ||
619 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) | |
3bc29f0a | 620 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template, |
b87700e3 AG |
621 | |
622 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
623 | ||
624 | TP_ARGS(usec_timeout, usec_delayed), | |
625 | ||
f127e61e MD |
626 | TP_FIELDS( |
627 | ctf_integer(unsigned int, usec_timeout, usec_timeout) | |
628 | ctf_integer(unsigned int, usec_delayed, usec_delayed) | |
629 | ) | |
b87700e3 AG |
630 | ) |
631 | ||
3bc29f0a | 632 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait, |
b87700e3 AG |
633 | |
634 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
635 | ||
636 | TP_ARGS(usec_timeout, usec_delayed) | |
637 | ) | |
638 | ||
3bc29f0a | 639 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested, |
b87700e3 AG |
640 | |
641 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
642 | ||
643 | TP_ARGS(usec_timeout, usec_delayed) | |
644 | ) | |
645 | #endif | |
646 | ||
647 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) | |
3bc29f0a | 648 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template, |
b87700e3 AG |
649 | |
650 | TP_PROTO(struct inode *inode, | |
651 | struct writeback_control *wbc, | |
652 | unsigned long nr_to_write | |
653 | ), | |
654 | ||
655 | TP_ARGS(inode, wbc, nr_to_write), | |
656 | ||
f127e61e MD |
657 | TP_FIELDS( |
658 | ctf_array_text(char, name, | |
659 | dev_name(inode_to_bdi(inode)->dev), 32) | |
660 | ctf_integer(unsigned long, ino, inode->i_ino) | |
661 | ctf_integer(unsigned long, state, inode->i_state) | |
662 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) | |
663 | ctf_integer(unsigned long, writeback_index, | |
664 | inode->i_mapping->writeback_index) | |
665 | ctf_integer(long, nr_to_write, nr_to_write) | |
666 | ctf_integer(unsigned long, wrote, | |
667 | nr_to_write - wbc->nr_to_write) | |
b87700e3 AG |
668 | ) |
669 | ) | |
670 | ||
671 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 672 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue, |
b87700e3 AG |
673 | TP_PROTO(struct inode *inode, |
674 | struct writeback_control *wbc, | |
675 | unsigned long nr_to_write), | |
676 | TP_ARGS(inode, wbc, nr_to_write) | |
677 | ) | |
678 | #endif | |
679 | ||
3bc29f0a | 680 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode, |
b87700e3 AG |
681 | TP_PROTO(struct inode *inode, |
682 | struct writeback_control *wbc, | |
683 | unsigned long nr_to_write), | |
684 | TP_ARGS(inode, wbc, nr_to_write) | |
685 | ) | |
686 | #endif | |
687 | ||
3bc29f0a | 688 | #endif /* LTTNG_TRACE_WRITEBACK_H */ |
b87700e3 AG |
689 | |
690 | /* This part must be outside protection */ | |
691 | #include "../../../probes/define_trace.h" |