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 | ||
3bc29f0a | 354 | LTTNG_TRACEPOINT_EVENT_MAP(bdi_dirty_ratelimit, |
9cf29d3e MD |
355 | |
356 | writeback_bdi_dirty_ratelimit, | |
b87700e3 AG |
357 | |
358 | TP_PROTO(struct backing_dev_info *bdi, | |
359 | unsigned long dirty_rate, | |
360 | unsigned long task_ratelimit), | |
361 | ||
362 | TP_ARGS(bdi, dirty_rate, task_ratelimit), | |
363 | ||
f127e61e MD |
364 | TP_FIELDS( |
365 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
9f305a2c MJ |
366 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) |
367 | ctf_integer(unsigned long, write_bw, KBps(bdi->wb.write_bandwidth)) | |
368 | ctf_integer(unsigned long, avg_write_bw, KBps(bdi->wb.avg_write_bandwidth)) | |
369 | #else | |
f127e61e MD |
370 | ctf_integer(unsigned long, write_bw, KBps(bdi->write_bandwidth)) |
371 | ctf_integer(unsigned long, avg_write_bw, KBps(bdi->avg_write_bandwidth)) | |
9f305a2c | 372 | #endif |
f127e61e | 373 | ctf_integer(unsigned long, dirty_rate, KBps(dirty_rate)) |
9f305a2c MJ |
374 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) |
375 | ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->wb.dirty_ratelimit)) | |
376 | #else | |
f127e61e | 377 | ctf_integer(unsigned long, dirty_ratelimit, KBps(bdi->dirty_ratelimit)) |
9f305a2c | 378 | #endif |
f127e61e | 379 | ctf_integer(unsigned long, task_ratelimit, KBps(task_ratelimit)) |
9f305a2c MJ |
380 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0)) |
381 | ctf_integer(unsigned long, balanced_dirty_ratelimit, | |
382 | KBps(bdi->wb.balanced_dirty_ratelimit)) | |
383 | #else | |
f127e61e | 384 | ctf_integer(unsigned long, balanced_dirty_ratelimit, |
b87700e3 | 385 | KBps(bdi->balanced_dirty_ratelimit)) |
9f305a2c | 386 | #endif |
b87700e3 AG |
387 | ) |
388 | ) | |
389 | ||
3bc29f0a | 390 | LTTNG_TRACEPOINT_EVENT_MAP(balance_dirty_pages, |
9cf29d3e MD |
391 | |
392 | writeback_balance_dirty_pages, | |
b87700e3 AG |
393 | |
394 | TP_PROTO(struct backing_dev_info *bdi, | |
395 | unsigned long thresh, | |
396 | unsigned long bg_thresh, | |
397 | unsigned long dirty, | |
398 | unsigned long bdi_thresh, | |
399 | unsigned long bdi_dirty, | |
400 | unsigned long dirty_ratelimit, | |
401 | unsigned long task_ratelimit, | |
402 | unsigned long dirtied, | |
403 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
404 | unsigned long period, | |
405 | #endif | |
406 | long pause, | |
407 | unsigned long start_time), | |
408 | ||
409 | TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, | |
410 | dirty_ratelimit, task_ratelimit, | |
411 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) | |
f127e61e | 412 | dirtied, period, pause, start_time |
b87700e3 | 413 | #else |
f127e61e | 414 | dirtied, pause, start_time |
b87700e3 AG |
415 | #endif |
416 | ), | |
417 | ||
f127e61e MD |
418 | TP_FIELDS( |
419 | ctf_array_text(char, bdi, dev_name(bdi->dev), 32) | |
420 | ctf_integer(unsigned long, limit, global_dirty_limit) | |
421 | ctf_integer(unsigned long, setpoint, | |
b87700e3 | 422 | (global_dirty_limit + (thresh + bg_thresh) / 2) / 2) |
f127e61e MD |
423 | ctf_integer(unsigned long, dirty, dirty) |
424 | ctf_integer(unsigned long, bdi_setpoint, | |
b87700e3 | 425 | ((global_dirty_limit + (thresh + bg_thresh) / 2) / 2) * |
f127e61e MD |
426 | bdi_thresh / (thresh + 1)) |
427 | ctf_integer(unsigned long, bdi_dirty, bdi_dirty) | |
428 | ctf_integer(unsigned long, dirty_ratelimit, | |
429 | KBps(dirty_ratelimit)) | |
430 | ctf_integer(unsigned long, task_ratelimit, | |
431 | KBps(task_ratelimit)) | |
432 | ctf_integer(unsigned int, dirtied, dirtied) | |
433 | ctf_integer(unsigned int, dirtied_pause, | |
434 | current->nr_dirtied_pause) | |
435 | ctf_integer(unsigned long, paused, | |
436 | (jiffies - start_time) * 1000 / HZ) | |
437 | ctf_integer(long, pause, pause * 1000 / HZ) | |
b87700e3 | 438 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) |
f127e61e MD |
439 | ctf_integer(unsigned long, period, |
440 | period * 1000 / HZ) | |
441 | ctf_integer(long, think, | |
442 | current->dirty_paused_when == 0 ? 0 : | |
443 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ) | |
b87700e3 | 444 | #endif |
f127e61e | 445 | ) |
b87700e3 AG |
446 | ) |
447 | #endif | |
448 | ||
449 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 450 | LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue, |
b87700e3 AG |
451 | |
452 | TP_PROTO(struct inode *inode), | |
453 | TP_ARGS(inode), | |
454 | ||
f127e61e MD |
455 | TP_FIELDS( |
456 | ctf_array_text(char, name, | |
457 | dev_name(inode_to_bdi(inode)->dev), 32) | |
458 | ctf_integer(unsigned long, ino, inode->i_ino) | |
459 | ctf_integer(unsigned long, state, inode->i_state) | |
460 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) | |
b87700e3 AG |
461 | ) |
462 | ) | |
463 | #endif | |
464 | ||
465 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) | |
3bc29f0a | 466 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template, |
b87700e3 AG |
467 | |
468 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
469 | ||
470 | TP_ARGS(usec_timeout, usec_delayed), | |
471 | ||
f127e61e MD |
472 | TP_FIELDS( |
473 | ctf_integer(unsigned int, usec_timeout, usec_timeout) | |
474 | ctf_integer(unsigned int, usec_delayed, usec_delayed) | |
475 | ) | |
b87700e3 AG |
476 | ) |
477 | ||
3bc29f0a | 478 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_congestion_wait, |
b87700e3 AG |
479 | |
480 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
481 | ||
482 | TP_ARGS(usec_timeout, usec_delayed) | |
483 | ) | |
484 | ||
3bc29f0a | 485 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wait_iff_congested, |
b87700e3 AG |
486 | |
487 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | |
488 | ||
489 | TP_ARGS(usec_timeout, usec_delayed) | |
490 | ) | |
491 | #endif | |
492 | ||
493 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0)) | |
3bc29f0a | 494 | LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template, |
b87700e3 AG |
495 | |
496 | TP_PROTO(struct inode *inode, | |
497 | struct writeback_control *wbc, | |
498 | unsigned long nr_to_write | |
499 | ), | |
500 | ||
501 | TP_ARGS(inode, wbc, nr_to_write), | |
502 | ||
f127e61e MD |
503 | TP_FIELDS( |
504 | ctf_array_text(char, name, | |
505 | dev_name(inode_to_bdi(inode)->dev), 32) | |
506 | ctf_integer(unsigned long, ino, inode->i_ino) | |
507 | ctf_integer(unsigned long, state, inode->i_state) | |
508 | ctf_integer(unsigned long, dirtied_when, inode->dirtied_when) | |
509 | ctf_integer(unsigned long, writeback_index, | |
510 | inode->i_mapping->writeback_index) | |
511 | ctf_integer(long, nr_to_write, nr_to_write) | |
512 | ctf_integer(unsigned long, wrote, | |
513 | nr_to_write - wbc->nr_to_write) | |
b87700e3 AG |
514 | ) |
515 | ) | |
516 | ||
517 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) | |
3bc29f0a | 518 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode_requeue, |
b87700e3 AG |
519 | TP_PROTO(struct inode *inode, |
520 | struct writeback_control *wbc, | |
521 | unsigned long nr_to_write), | |
522 | TP_ARGS(inode, wbc, nr_to_write) | |
523 | ) | |
524 | #endif | |
525 | ||
3bc29f0a | 526 | LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_single_inode_template, writeback_single_inode, |
b87700e3 AG |
527 | TP_PROTO(struct inode *inode, |
528 | struct writeback_control *wbc, | |
529 | unsigned long nr_to_write), | |
530 | TP_ARGS(inode, wbc, nr_to_write) | |
531 | ) | |
532 | #endif | |
533 | ||
3bc29f0a | 534 | #endif /* LTTNG_TRACE_WRITEBACK_H */ |
b87700e3 AG |
535 | |
536 | /* This part must be outside protection */ | |
537 | #include "../../../probes/define_trace.h" |