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 | ||
99a570c8 MD |
165 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) |
166 | ||
167 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, | |
168 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), | |
169 | TP_ARGS(bdi, work), | |
f127e61e MD |
170 | TP_FIELDS( |
171 | ctf_array_text(char, name, bdi->dev ? dev_name(bdi->dev) : | |
99a570c8 | 172 | "(unknown)", 32) |
99a570c8 MD |
173 | ) |
174 | ) | |
175 | ||
176 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */ | |
177 | ||
3bc29f0a | 178 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_work_class, |
b87700e3 AG |
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, | |
183 | dev_name(bdi->dev ? bdi->dev : | |
b87700e3 | 184 | default_backing_dev_info.dev), 32) |
b87700e3 | 185 | ) |
b87700e3 | 186 | ) |
99a570c8 MD |
187 | |
188 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)) */ | |
189 | ||
3bc29f0a MD |
190 | #define LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(name) \ |
191 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_work_class, name, \ | |
b87700e3 AG |
192 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ |
193 | TP_ARGS(bdi, work)) | |
3bc29f0a MD |
194 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_nothread) |
195 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_queue) | |
196 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_exec) | |
b87700e3 | 197 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) |
3bc29f0a MD |
198 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_start) |
199 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_written) | |
200 | LTTNG_TRACEPOINT_EVENT_WRITEBACK_WORK_INSTANCE(writeback_wait) | |
b87700e3 AG |
201 | #endif |
202 | ||
3bc29f0a | 203 | LTTNG_TRACEPOINT_EVENT(writeback_pages_written, |
b87700e3 AG |
204 | TP_PROTO(long pages_written), |
205 | TP_ARGS(pages_written), | |
f127e61e MD |
206 | TP_FIELDS( |
207 | ctf_integer(long, pages, pages_written) | |
208 | ) | |
b87700e3 AG |
209 | ) |
210 | ||
3bc29f0a | 211 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_class, |
b87700e3 AG |
212 | TP_PROTO(struct backing_dev_info *bdi), |
213 | TP_ARGS(bdi), | |
f127e61e MD |
214 | TP_FIELDS( |
215 | ctf_array_text(char, name, | |
216 | dev_name(bdi->dev), 32) | |
b87700e3 AG |
217 | ) |
218 | ) | |
59fecd6c | 219 | #undef DEFINE_WRITEBACK_EVENT |
b87700e3 | 220 | #define DEFINE_WRITEBACK_EVENT(name) \ |
3bc29f0a | 221 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_class, name, \ |
b87700e3 AG |
222 | TP_PROTO(struct backing_dev_info *bdi), \ |
223 | TP_ARGS(bdi)) | |
224 | ||
9cf29d3e | 225 | #define DEFINE_WRITEBACK_EVENT_MAP(name, map) \ |
3bc29f0a | 226 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_class, name, map, \ |
9cf29d3e MD |
227 | TP_PROTO(struct backing_dev_info *bdi), \ |
228 | TP_ARGS(bdi)) | |
229 | ||
b87700e3 AG |
230 | DEFINE_WRITEBACK_EVENT(writeback_nowork) |
231 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) | |
232 | DEFINE_WRITEBACK_EVENT(writeback_wake_background) | |
233 | #endif | |
234 | DEFINE_WRITEBACK_EVENT(writeback_wake_thread) | |
235 | DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread) | |
236 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register) | |
237 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister) | |
238 | DEFINE_WRITEBACK_EVENT(writeback_thread_start) | |
239 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop) | |
240 | #if (LTTNG_KERNEL_RANGE(3,1,0, 3,2,0)) | |
9cf29d3e MD |
241 | DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_start, writeback_balance_dirty_start) |
242 | DEFINE_WRITEBACK_EVENT_MAP(balance_dirty_wait, writeback_balance_dirty_wait) | |
243 | ||
3bc29f0a | 244 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_written, |
b87700e3 | 245 | |
9cf29d3e | 246 | writeback_balance_dirty_written, |
b87700e3 AG |
247 | |
248 | TP_PROTO(struct backing_dev_info *bdi, int written), | |
249 | ||
250 | TP_ARGS(bdi, written), | |
251 | ||
f127e61e MD |
252 | TP_FIELDS( |
253 | ctf_array_text(char, name, dev_name(bdi->dev), 32) | |
254 | ctf_integer(int, written, written) | |
b87700e3 AG |
255 | ) |
256 | ) | |
257 | #endif | |
258 | ||
3bc29f0a | 259 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_wbc_class, |
b87700e3 AG |
260 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
261 | TP_ARGS(wbc, bdi), | |
f127e61e MD |
262 | TP_FIELDS( |
263 | ctf_array_text(char, name, dev_name(bdi->dev), 32) | |
264 | ctf_integer(long, nr_to_write, wbc->nr_to_write) | |
265 | ctf_integer(long, pages_skipped, wbc->pages_skipped) | |
266 | ctf_integer(int, sync_mode, wbc->sync_mode) | |
267 | ctf_integer(int, for_kupdate, wbc->for_kupdate) | |
268 | ctf_integer(int, for_background, wbc->for_background) | |
269 | ctf_integer(int, for_reclaim, wbc->for_reclaim) | |
270 | ctf_integer(int, range_cyclic, wbc->range_cyclic) | |
b87700e3 | 271 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) |
f127e61e MD |
272 | ctf_integer(int, more_io, wbc->more_io) |
273 | ctf_integer(unsigned long, older_than_this, | |
274 | wbc->older_than_this ? *wbc->older_than_this : 0) | |
b87700e3 | 275 | #endif |
f127e61e MD |
276 | ctf_integer(long, range_start, (long) wbc->range_start) |
277 | ctf_integer(long, range_end, (long) wbc->range_end) | |
278 | ) | |
b87700e3 AG |
279 | ) |
280 | ||
9cf29d3e | 281 | #undef DEFINE_WBC_EVENT |
3bc29f0a MD |
282 | #define LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(name, map) \ |
283 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(writeback_wbc_class, name, map, \ | |
b87700e3 AG |
284 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
285 | TP_ARGS(wbc, bdi)) | |
286 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0)) | |
3bc29f0a MD |
287 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_start, writeback_wbc_writeback_start) |
288 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_written, writeback_wbc_writeback_written) | |
289 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writeback_wait, writeback_wbc_writeback_wait) | |
290 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_start, writeback_wbc_balance_dirty_start) | |
291 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_written, writeback_wbc_balance_dirty_written) | |
292 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balance_dirty_wait) | |
b87700e3 | 293 | #endif |
3bc29f0a | 294 | LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage) |
b87700e3 AG |
295 | |
296 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) | |
3bc29f0a | 297 | LTTNG_TRACEPOINT_EVENT(writeback_queue_io, |
b87700e3 AG |
298 | TP_PROTO(struct bdi_writeback *wb, |
299 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) | |
300 | struct wb_writeback_work *work, | |
301 | #else | |
302 | unsigned long *older_than_this, | |
303 | #endif | |
304 | int moved), | |
305 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) | |
306 | TP_ARGS(wb, work, moved), | |
307 | #else | |
308 | TP_ARGS(wb, older_than_this, moved), | |
309 | #endif | |
f127e61e MD |
310 | TP_FIELDS( |
311 | ctf_array_text(char, name, dev_name(wb->bdi->dev), 32) | |
b87700e3 | 312 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) |
b87700e3 | 313 | #else |
f127e61e MD |
314 | ctf_integer(unsigned long, older, |
315 | older_than_this ? *older_than_this : 0) | |
316 | ctf_integer(long, age, | |
317 | older_than_this ? | |
318 | (jiffies - *older_than_this) * 1000 / HZ | |
319 | : -1) | |
b87700e3 | 320 | #endif |
f127e61e | 321 | ctf_integer(int, moved, moved) |
b87700e3 | 322 | ) |
b87700e3 AG |
323 | ) |
324 | ||
3bc29f0a | 325 | LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state, |
9cf29d3e MD |
326 | |
327 | writeback_global_dirty_state, | |
b87700e3 AG |
328 | |
329 | TP_PROTO(unsigned long background_thresh, | |
330 | unsigned long dirty_thresh | |
331 | ), | |
332 | ||
333 | TP_ARGS(background_thresh, | |
334 | dirty_thresh | |
335 | ), | |
336 | ||
f127e61e MD |
337 | TP_FIELDS( |
338 | ctf_integer(unsigned long, nr_dirty, global_page_state(NR_FILE_DIRTY)) | |
339 | ctf_integer(unsigned long, nr_writeback, global_page_state(NR_WRITEBACK)) | |
340 | ctf_integer(unsigned long, nr_unstable, global_page_state(NR_UNSTABLE_NFS)) | |
341 | ctf_integer(unsigned long, nr_dirtied, global_page_state(NR_DIRTIED)) | |
342 | ctf_integer(unsigned long, nr_written, global_page_state(NR_WRITTEN)) | |
343 | ctf_integer(unsigned long, background_thresh, background_thresh) | |
344 | ctf_integer(unsigned long, dirty_thresh, dirty_thresh) | |
345 | ctf_integer(unsigned long, dirty_limit, global_dirty_limit) | |
b87700e3 AG |
346 | ) |
347 | ) | |
348 | #endif | |
349 | ||
350 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) | |
351 | ||
352 | #define KBps(x) ((x) << (PAGE_SHIFT - 10)) | |
353 | ||
c7d89a6d MD |
354 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) |
355 | ||
3bc29f0a | 356 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, |
9cf29d3e MD |
357 | |
358 | writeback_bdi_dirty_ratelimit, | |
b87700e3 AG |
359 | |
360 | TP_PROTO(struct backing_dev_info *bdi, | |
361 | unsigned long dirty_rate, | |
362 | unsigned long task_ratelimit), | |
363 | ||
364 | TP_ARGS(bdi, dirty_rate, task_ratelimit), | |
365 | ||
f127e61e MD |
366 | TP_FIELDS( |
367 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
902947a4 MJ |
368 | ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth)) |
369 | ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth)) | |
f127e61e | 370 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) |
902947a4 | 371 | ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit)) |
f127e61e | 372 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) |
902947a4 MJ |
373 | ctf_integer(unsigned long, balanced_dirty_ratelimit, |
374 | KBps(bdi->wb.balanced_dirty_ratelimit)) | |
c7d89a6d MD |
375 | ) |
376 | ) | |
377 | ||
378 | #else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */ | |
379 | ||
380 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, | |
381 | ||
382 | writeback_bdi_dirty_ratelimit, | |
383 | ||
384 | TP_PROTO(struct backing_dev_info *bdi, | |
385 | unsigned long dirty_rate, | |
386 | unsigned long task_ratelimit), | |
387 | ||
388 | TP_ARGS(bdi, dirty_rate, task_ratelimit), | |
389 | ||
390 | TP_FIELDS( | |
391 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
392 | ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth)) | |
393 | ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth)) | |
394 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) | |
395 | ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit)) | |
396 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) | |
f127e61e | 397 | ctf_integer(unsigned long, balanced_dirty_ratelimit, |
b87700e3 | 398 | KBps(bdi->balanced_dirty_ratelimit)) |
b87700e3 AG |
399 | ) |
400 | ) | |
401 | ||
c7d89a6d MD |
402 | #endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) */ |
403 | ||
3bc29f0a | 404 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, |
9cf29d3e MD |
405 | |
406 | writeback_balance_dirty_pages, | |
b87700e3 AG |
407 | |
408 | TP_PROTO(struct backing_dev_info *bdi, | |
409 | unsigned long thresh, | |
410 | unsigned long bg_thresh, | |
411 | unsigned long dirty, | |
412 | unsigned long bdi_thresh, | |
413 | unsigned long bdi_dirty, | |
414 | unsigned long dirty_ratelimit, | |
415 | unsigned long task_ratelimit, | |
416 | unsigned long dirtied, | |
417 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
418 | unsigned long period, | |
419 | #endif | |
420 | long pause, | |
421 | unsigned long start_time), | |
422 | ||
423 | TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, | |
424 | dirty_ratelimit, task_ratelimit, | |
425 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
f127e61e | 426 | dirtied, period, pause, start_time |
b87700e3 | 427 | #else |
f127e61e | 428 | dirtied, pause, start_time |
b87700e3 AG |
429 | #endif |
430 | ), | |
431 | ||
f127e61e MD |
432 | TP_FIELDS( |
433 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
434 | ctf_integer(unsigned long, limit, global_dirty_limit) | |
435 | ctf_integer(unsigned long, setpoint, | |
b87700e3 | 436 | (global_dirty_limit + (thresh + bg_thresh) / 2) / 2) |
f127e61e MD |
437 | ctf_integer(unsigned long, dirty, dirty) |
438 | ctf_integer(unsigned long, bdi_setpoint, | |
b87700e3 | 439 | ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) * |
f127e61e MD |
440 | bdi_thresh / (thresh + 1)) |
441 | ctf_integer(unsigned long, bdi_dirty, bdi_dirty) | |
442 | ctf_integer(unsigned long, dirty_ratelimit, | |
443 | KBps(dirty_ratelimit)) | |
444 | ctf_integer(unsigned long, task_ratelimit, | |
445 | KBps(task_ratelimit)) | |
446 | ctf_integer(unsigned int, dirtied, dirtied) | |
447 | ctf_integer(unsigned int, dirtied_pause, | |
448 | current->nr_dirtied_pause) | |
449 | ctf_integer(unsigned long, paused, | |
450 | (jiffies - start_time) * 1000 / HZ) | |
451 | ctf_integer(long, pause, pause * 1000 / HZ) | |
b87700e3 | 452 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
f127e61e MD |
453 | ctf_integer(unsigned long, period, |
454 | period * 1000 / HZ) | |
455 | ctf_integer(long, think, | |
456 | current->dirty_paused_when == 0 ? 0 : | |
457 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ) | |
b87700e3 | 458 | #endif |
f127e61e | 459 | ) |
b87700e3 AG |
460 | ) |
461 | #endif | |
462 | ||
463 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 464 | LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue, |
b87700e3 AG |
465 | |
466 | TP_PROTO(struct inode *inode), | |
467 | TP_ARGS(inode), | |
468 | ||
f127e61e MD |
469 | TP_FIELDS( |
470 | ctf_array_text(char, name, | |
471 | dev_name(inode_to_bdi(inode)->dev), 32) | |
472 | ctf_integer(unsigned long, ino, inode->i_ino) | |
473 | ctf_integer(unsigned long, state, inode->i_state) | |
474 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) | |
b87700e3 AG |
475 | ) |
476 | ) | |
477 | #endif | |
478 | ||
479 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) | |
3bc29f0a | 480 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template, |
b87700e3 AG |
481 | |
482 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
483 | ||
484 | TP_ARGS(usec_timeout, usec_delayed), | |
485 | ||
f127e61e MD |
486 | TP_FIELDS( |
487 | ctf_integer(unsigned int, usec_timeout, usec_timeout) | |
488 | ctf_integer(unsigned int, usec_delayed, usec_delayed) | |
489 | ) | |
b87700e3 AG |
490 | ) |
491 | ||
3bc29f0a | 492 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait, |
b87700e3 AG |
493 | |
494 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
495 | ||
496 | TP_ARGS(usec_timeout, usec_delayed) | |
497 | ) | |
498 | ||
3bc29f0a | 499 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested, |
b87700e3 AG |
500 | |
501 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
502 | ||
503 | TP_ARGS(usec_timeout, usec_delayed) | |
504 | ) | |
505 | #endif | |
506 | ||
507 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) | |
3bc29f0a | 508 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template, |
b87700e3 AG |
509 | |
510 | TP_PROTO(struct inode *inode, | |
511 | struct writeback_control *wbc, | |
512 | unsigned long nr_to_write | |
513 | ), | |
514 | ||
515 | TP_ARGS(inode, wbc, nr_to_write), | |
516 | ||
f127e61e MD |
517 | TP_FIELDS( |
518 | ctf_array_text(char, name, | |
519 | dev_name(inode_to_bdi(inode)->dev), 32) | |
520 | ctf_integer(unsigned long, ino, inode->i_ino) | |
521 | ctf_integer(unsigned long, state, inode->i_state) | |
522 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) | |
523 | ctf_integer(unsigned long, writeback_index, | |
524 | inode->i_mapping->writeback_index) | |
525 | ctf_integer(long, nr_to_write, nr_to_write) | |
526 | ctf_integer(unsigned long, wrote, | |
527 | nr_to_write - wbc->nr_to_write) | |
b87700e3 AG |
528 | ) |
529 | ) | |
530 | ||
531 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 532 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue, |
b87700e3 AG |
533 | TP_PROTO(struct inode *inode, |
534 | struct writeback_control *wbc, | |
535 | unsigned long nr_to_write), | |
536 | TP_ARGS(inode, wbc, nr_to_write) | |
537 | ) | |
538 | #endif | |
539 | ||
3bc29f0a | 540 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode, |
b87700e3 AG |
541 | TP_PROTO(struct inode *inode, |
542 | struct writeback_control *wbc, | |
543 | unsigned long nr_to_write), | |
544 | TP_ARGS(inode, wbc, nr_to_write) | |
545 | ) | |
546 | #endif | |
547 | ||
3bc29f0a | 548 | #endif /* LTTNG_TRACE_WRITEBACK_H */ |
b87700e3 AG |
549 | |
550 | /* This part must be outside protection */ | |
551 | #include "../../../probes/define_trace.h" |