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