blob: 84ab72df953cb5492063c35d5da56d8ad9a3487c [file] [log] [blame]
Dave Chinner455b2862010-07-07 13:24:06 +10001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM writeback
3
4#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_WRITEBACK_H
6
7#include <linux/backing-dev.h>
Randy Dunlap96dccab2010-07-19 16:49:17 -07008#include <linux/device.h>
Dave Chinner455b2862010-07-07 13:24:06 +10009#include <linux/writeback.h>
10
11struct wb_writeback_work;
12
13DECLARE_EVENT_CLASS(writeback_work_class,
14 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
15 TP_ARGS(bdi, work),
16 TP_STRUCT__entry(
17 __array(char, name, 32)
18 __field(long, nr_pages)
19 __field(dev_t, sb_dev)
20 __field(int, sync_mode)
21 __field(int, for_kupdate)
22 __field(int, range_cyclic)
23 __field(int, for_background)
24 ),
25 TP_fast_assign(
26 strncpy(__entry->name, dev_name(bdi->dev), 32);
27 __entry->nr_pages = work->nr_pages;
28 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
29 __entry->sync_mode = work->sync_mode;
30 __entry->for_kupdate = work->for_kupdate;
31 __entry->range_cyclic = work->range_cyclic;
32 __entry->for_background = work->for_background;
33 ),
34 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
35 "kupdate=%d range_cyclic=%d background=%d",
36 __entry->name,
37 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
38 __entry->nr_pages,
39 __entry->sync_mode,
40 __entry->for_kupdate,
41 __entry->range_cyclic,
42 __entry->for_background
43 )
44);
45#define DEFINE_WRITEBACK_WORK_EVENT(name) \
46DEFINE_EVENT(writeback_work_class, name, \
47 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
48 TP_ARGS(bdi, work))
49DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
50DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
51DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
52
53TRACE_EVENT(writeback_pages_written,
54 TP_PROTO(long pages_written),
55 TP_ARGS(pages_written),
56 TP_STRUCT__entry(
57 __field(long, pages)
58 ),
59 TP_fast_assign(
60 __entry->pages = pages_written;
61 ),
62 TP_printk("%ld", __entry->pages)
63);
64
65DECLARE_EVENT_CLASS(writeback_class,
66 TP_PROTO(struct backing_dev_info *bdi),
67 TP_ARGS(bdi),
68 TP_STRUCT__entry(
69 __array(char, name, 32)
70 ),
71 TP_fast_assign(
72 strncpy(__entry->name, dev_name(bdi->dev), 32);
73 ),
74 TP_printk("bdi %s",
75 __entry->name
76 )
77);
78#define DEFINE_WRITEBACK_EVENT(name) \
79DEFINE_EVENT(writeback_class, name, \
80 TP_PROTO(struct backing_dev_info *bdi), \
81 TP_ARGS(bdi))
82
83DEFINE_WRITEBACK_EVENT(writeback_nowork);
84DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
85DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
86DEFINE_WRITEBACK_EVENT(writeback_thread_start);
87DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
88
Dave Chinner028c2dd2010-07-07 13:24:07 +100089DECLARE_EVENT_CLASS(wbc_class,
90 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
91 TP_ARGS(wbc, bdi),
92 TP_STRUCT__entry(
93 __array(char, name, 32)
94 __field(long, nr_to_write)
95 __field(long, pages_skipped)
96 __field(int, sync_mode)
97 __field(int, nonblocking)
98 __field(int, encountered_congestion)
99 __field(int, for_kupdate)
100 __field(int, for_background)
101 __field(int, for_reclaim)
102 __field(int, range_cyclic)
103 __field(int, more_io)
104 __field(unsigned long, older_than_this)
105 __field(long, range_start)
106 __field(long, range_end)
107 ),
108
109 TP_fast_assign(
110 strncpy(__entry->name, dev_name(bdi->dev), 32);
111 __entry->nr_to_write = wbc->nr_to_write;
112 __entry->pages_skipped = wbc->pages_skipped;
113 __entry->sync_mode = wbc->sync_mode;
114 __entry->for_kupdate = wbc->for_kupdate;
115 __entry->for_background = wbc->for_background;
116 __entry->for_reclaim = wbc->for_reclaim;
117 __entry->range_cyclic = wbc->range_cyclic;
118 __entry->more_io = wbc->more_io;
119 __entry->older_than_this = wbc->older_than_this ?
120 *wbc->older_than_this : 0;
121 __entry->range_start = (long)wbc->range_start;
122 __entry->range_end = (long)wbc->range_end;
123 ),
124
125 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
126 "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx "
127 "start=0x%lx end=0x%lx",
128 __entry->name,
129 __entry->nr_to_write,
130 __entry->pages_skipped,
131 __entry->sync_mode,
132 __entry->for_kupdate,
133 __entry->for_background,
134 __entry->for_reclaim,
135 __entry->range_cyclic,
136 __entry->more_io,
137 __entry->older_than_this,
138 __entry->range_start,
139 __entry->range_end)
140)
141
142#define DEFINE_WBC_EVENT(name) \
143DEFINE_EVENT(wbc_class, name, \
144 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
145 TP_ARGS(wbc, bdi))
146DEFINE_WBC_EVENT(wbc_writeback_start);
147DEFINE_WBC_EVENT(wbc_writeback_written);
148DEFINE_WBC_EVENT(wbc_writeback_wait);
149DEFINE_WBC_EVENT(wbc_balance_dirty_start);
150DEFINE_WBC_EVENT(wbc_balance_dirty_written);
151DEFINE_WBC_EVENT(wbc_balance_dirty_wait);
Dave Chinner9e094382010-07-07 13:24:08 +1000152DEFINE_WBC_EVENT(wbc_writepage);
Dave Chinner028c2dd2010-07-07 13:24:07 +1000153
Dave Chinner455b2862010-07-07 13:24:06 +1000154#endif /* _TRACE_WRITEBACK_H */
155
156/* This part must be outside protection */
157#include <trace/define_trace.h>