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