sysfs: Remove support for tagged directories with untagged members (again)
[linux-btrfs-devel.git] / include / trace / events / writeback.h
blob5f172703eb4f2cafc74064388462ac9ec5192144
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM writeback
4 #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_WRITEBACK_H
7 #include <linux/backing-dev.h>
8 #include <linux/device.h>
9 #include <linux/writeback.h>
11 #define show_inode_state(state) \
12 __print_flags(state, "|", \
13 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \
14 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \
15 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \
16 {I_NEW, "I_NEW"}, \
17 {I_WILL_FREE, "I_WILL_FREE"}, \
18 {I_FREEING, "I_FREEING"}, \
19 {I_CLEAR, "I_CLEAR"}, \
20 {I_SYNC, "I_SYNC"}, \
21 {I_REFERENCED, "I_REFERENCED"} \
24 struct wb_writeback_work;
26 DECLARE_EVENT_CLASS(writeback_work_class,
27 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
28 TP_ARGS(bdi, work),
29 TP_STRUCT__entry(
30 __array(char, name, 32)
31 __field(long, nr_pages)
32 __field(dev_t, sb_dev)
33 __field(int, sync_mode)
34 __field(int, for_kupdate)
35 __field(int, range_cyclic)
36 __field(int, for_background)
38 TP_fast_assign(
39 strncpy(__entry->name, dev_name(bdi->dev), 32);
40 __entry->nr_pages = work->nr_pages;
41 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
42 __entry->sync_mode = work->sync_mode;
43 __entry->for_kupdate = work->for_kupdate;
44 __entry->range_cyclic = work->range_cyclic;
45 __entry->for_background = work->for_background;
47 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
48 "kupdate=%d range_cyclic=%d background=%d",
49 __entry->name,
50 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
51 __entry->nr_pages,
52 __entry->sync_mode,
53 __entry->for_kupdate,
54 __entry->range_cyclic,
55 __entry->for_background
58 #define DEFINE_WRITEBACK_WORK_EVENT(name) \
59 DEFINE_EVENT(writeback_work_class, name, \
60 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
61 TP_ARGS(bdi, work))
62 DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
63 DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
64 DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
65 DEFINE_WRITEBACK_WORK_EVENT(writeback_start);
66 DEFINE_WRITEBACK_WORK_EVENT(writeback_written);
67 DEFINE_WRITEBACK_WORK_EVENT(writeback_wait);
69 TRACE_EVENT(writeback_pages_written,
70 TP_PROTO(long pages_written),
71 TP_ARGS(pages_written),
72 TP_STRUCT__entry(
73 __field(long, pages)
75 TP_fast_assign(
76 __entry->pages = pages_written;
78 TP_printk("%ld", __entry->pages)
81 DECLARE_EVENT_CLASS(writeback_class,
82 TP_PROTO(struct backing_dev_info *bdi),
83 TP_ARGS(bdi),
84 TP_STRUCT__entry(
85 __array(char, name, 32)
87 TP_fast_assign(
88 strncpy(__entry->name, dev_name(bdi->dev), 32);
90 TP_printk("bdi %s",
91 __entry->name
94 #define DEFINE_WRITEBACK_EVENT(name) \
95 DEFINE_EVENT(writeback_class, name, \
96 TP_PROTO(struct backing_dev_info *bdi), \
97 TP_ARGS(bdi))
99 DEFINE_WRITEBACK_EVENT(writeback_nowork);
100 DEFINE_WRITEBACK_EVENT(writeback_wake_background);
101 DEFINE_WRITEBACK_EVENT(writeback_wake_thread);
102 DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread);
103 DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
104 DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
105 DEFINE_WRITEBACK_EVENT(writeback_thread_start);
106 DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
107 DEFINE_WRITEBACK_EVENT(balance_dirty_start);
108 DEFINE_WRITEBACK_EVENT(balance_dirty_wait);
110 TRACE_EVENT(balance_dirty_written,
112 TP_PROTO(struct backing_dev_info *bdi, int written),
114 TP_ARGS(bdi, written),
116 TP_STRUCT__entry(
117 __array(char, name, 32)
118 __field(int, written)
121 TP_fast_assign(
122 strncpy(__entry->name, dev_name(bdi->dev), 32);
123 __entry->written = written;
126 TP_printk("bdi %s written %d",
127 __entry->name,
128 __entry->written
132 DECLARE_EVENT_CLASS(wbc_class,
133 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
134 TP_ARGS(wbc, bdi),
135 TP_STRUCT__entry(
136 __array(char, name, 32)
137 __field(long, nr_to_write)
138 __field(long, pages_skipped)
139 __field(int, sync_mode)
140 __field(int, for_kupdate)
141 __field(int, for_background)
142 __field(int, for_reclaim)
143 __field(int, range_cyclic)
144 __field(long, range_start)
145 __field(long, range_end)
148 TP_fast_assign(
149 strncpy(__entry->name, dev_name(bdi->dev), 32);
150 __entry->nr_to_write = wbc->nr_to_write;
151 __entry->pages_skipped = wbc->pages_skipped;
152 __entry->sync_mode = wbc->sync_mode;
153 __entry->for_kupdate = wbc->for_kupdate;
154 __entry->for_background = wbc->for_background;
155 __entry->for_reclaim = wbc->for_reclaim;
156 __entry->range_cyclic = wbc->range_cyclic;
157 __entry->range_start = (long)wbc->range_start;
158 __entry->range_end = (long)wbc->range_end;
161 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
162 "bgrd=%d reclm=%d cyclic=%d "
163 "start=0x%lx end=0x%lx",
164 __entry->name,
165 __entry->nr_to_write,
166 __entry->pages_skipped,
167 __entry->sync_mode,
168 __entry->for_kupdate,
169 __entry->for_background,
170 __entry->for_reclaim,
171 __entry->range_cyclic,
172 __entry->range_start,
173 __entry->range_end)
176 #define DEFINE_WBC_EVENT(name) \
177 DEFINE_EVENT(wbc_class, name, \
178 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
179 TP_ARGS(wbc, bdi))
180 DEFINE_WBC_EVENT(wbc_writepage);
182 TRACE_EVENT(writeback_queue_io,
183 TP_PROTO(struct bdi_writeback *wb,
184 unsigned long *older_than_this,
185 int moved),
186 TP_ARGS(wb, older_than_this, moved),
187 TP_STRUCT__entry(
188 __array(char, name, 32)
189 __field(unsigned long, older)
190 __field(long, age)
191 __field(int, moved)
193 TP_fast_assign(
194 strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
195 __entry->older = older_than_this ? *older_than_this : 0;
196 __entry->age = older_than_this ?
197 (jiffies - *older_than_this) * 1000 / HZ : -1;
198 __entry->moved = moved;
200 TP_printk("bdi %s: older=%lu age=%ld enqueue=%d",
201 __entry->name,
202 __entry->older, /* older_than_this in jiffies */
203 __entry->age, /* older_than_this in relative milliseconds */
204 __entry->moved)
207 TRACE_EVENT(global_dirty_state,
209 TP_PROTO(unsigned long background_thresh,
210 unsigned long dirty_thresh
213 TP_ARGS(background_thresh,
214 dirty_thresh
217 TP_STRUCT__entry(
218 __field(unsigned long, nr_dirty)
219 __field(unsigned long, nr_writeback)
220 __field(unsigned long, nr_unstable)
221 __field(unsigned long, background_thresh)
222 __field(unsigned long, dirty_thresh)
223 __field(unsigned long, dirty_limit)
224 __field(unsigned long, nr_dirtied)
225 __field(unsigned long, nr_written)
228 TP_fast_assign(
229 __entry->nr_dirty = global_page_state(NR_FILE_DIRTY);
230 __entry->nr_writeback = global_page_state(NR_WRITEBACK);
231 __entry->nr_unstable = global_page_state(NR_UNSTABLE_NFS);
232 __entry->nr_dirtied = global_page_state(NR_DIRTIED);
233 __entry->nr_written = global_page_state(NR_WRITTEN);
234 __entry->background_thresh = background_thresh;
235 __entry->dirty_thresh = dirty_thresh;
236 __entry->dirty_limit = global_dirty_limit;
239 TP_printk("dirty=%lu writeback=%lu unstable=%lu "
240 "bg_thresh=%lu thresh=%lu limit=%lu "
241 "dirtied=%lu written=%lu",
242 __entry->nr_dirty,
243 __entry->nr_writeback,
244 __entry->nr_unstable,
245 __entry->background_thresh,
246 __entry->dirty_thresh,
247 __entry->dirty_limit,
248 __entry->nr_dirtied,
249 __entry->nr_written
253 DECLARE_EVENT_CLASS(writeback_congest_waited_template,
255 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
257 TP_ARGS(usec_timeout, usec_delayed),
259 TP_STRUCT__entry(
260 __field( unsigned int, usec_timeout )
261 __field( unsigned int, usec_delayed )
264 TP_fast_assign(
265 __entry->usec_timeout = usec_timeout;
266 __entry->usec_delayed = usec_delayed;
269 TP_printk("usec_timeout=%u usec_delayed=%u",
270 __entry->usec_timeout,
271 __entry->usec_delayed)
274 DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait,
276 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
278 TP_ARGS(usec_timeout, usec_delayed)
281 DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested,
283 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
285 TP_ARGS(usec_timeout, usec_delayed)
288 DECLARE_EVENT_CLASS(writeback_single_inode_template,
290 TP_PROTO(struct inode *inode,
291 struct writeback_control *wbc,
292 unsigned long nr_to_write
295 TP_ARGS(inode, wbc, nr_to_write),
297 TP_STRUCT__entry(
298 __array(char, name, 32)
299 __field(unsigned long, ino)
300 __field(unsigned long, state)
301 __field(unsigned long, dirtied_when)
302 __field(unsigned long, writeback_index)
303 __field(long, nr_to_write)
304 __field(unsigned long, wrote)
307 TP_fast_assign(
308 strncpy(__entry->name,
309 dev_name(inode->i_mapping->backing_dev_info->dev), 32);
310 __entry->ino = inode->i_ino;
311 __entry->state = inode->i_state;
312 __entry->dirtied_when = inode->dirtied_when;
313 __entry->writeback_index = inode->i_mapping->writeback_index;
314 __entry->nr_to_write = nr_to_write;
315 __entry->wrote = nr_to_write - wbc->nr_to_write;
318 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu "
319 "index=%lu to_write=%ld wrote=%lu",
320 __entry->name,
321 __entry->ino,
322 show_inode_state(__entry->state),
323 __entry->dirtied_when,
324 (jiffies - __entry->dirtied_when) / HZ,
325 __entry->writeback_index,
326 __entry->nr_to_write,
327 __entry->wrote
331 DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue,
332 TP_PROTO(struct inode *inode,
333 struct writeback_control *wbc,
334 unsigned long nr_to_write),
335 TP_ARGS(inode, wbc, nr_to_write)
338 DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode,
339 TP_PROTO(struct inode *inode,
340 struct writeback_control *wbc,
341 unsigned long nr_to_write),
342 TP_ARGS(inode, wbc, nr_to_write)
345 #endif /* _TRACE_WRITEBACK_H */
347 /* This part must be outside protection */
348 #include <trace/define_trace.h>