aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-07-06 23:24:06 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-08-07 12:24:23 -0400
commit455b2864686d3591b3b2f39eb46290c95f76471f (patch)
treeb88059e3691fc5ad4491518e9eb1f1f2ba21711a /include/trace
parenta89f5c899db3c6be4bb426e4efb72ecee29a93b5 (diff)
writeback: Initial tracing support
Trace queue/sched/exec parts of the writeback loop. This provides insight into when and why flusher threads are scheduled to run. e.g a sync invocation leaves traces like: sync-[...]: writeback_queue: bdi 8:0: sb_dev 8:1 nr_pages=7712 sync_mode=0 kupdate=0 range_cyclic=0 background=0 flush-8:0-[...]: writeback_exec: bdi 8:0: sb_dev 8:1 nr_pages=7712 sync_mode=0 kupdate=0 range_cyclic=0 background=0 This also lays the foundation for adding more writeback tracing to provide deeper insight into the whole writeback path. The original tracing code is from Jens Axboe, though this version is a rewrite as a result of the code being traced changing significantly. Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/writeback.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h
new file mode 100644
index 000000000000..562fcae10d9d
--- /dev/null
+++ b/include/trace/events/writeback.h
@@ -0,0 +1,91 @@
1#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>
8#include <linux/writeback.h>
9
10struct wb_writeback_work;
11
12DECLARE_EVENT_CLASS(writeback_work_class,
13 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
14 TP_ARGS(bdi, work),
15 TP_STRUCT__entry(
16 __array(char, name, 32)
17 __field(long, nr_pages)
18 __field(dev_t, sb_dev)
19 __field(int, sync_mode)
20 __field(int, for_kupdate)
21 __field(int, range_cyclic)
22 __field(int, for_background)
23 ),
24 TP_fast_assign(
25 strncpy(__entry->name, dev_name(bdi->dev), 32);
26 __entry->nr_pages = work->nr_pages;
27 __entry->sb_dev = work->sb ? work->sb->s_dev : 0;
28 __entry->sync_mode = work->sync_mode;
29 __entry->for_kupdate = work->for_kupdate;
30 __entry->range_cyclic = work->range_cyclic;
31 __entry->for_background = work->for_background;
32 ),
33 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
34 "kupdate=%d range_cyclic=%d background=%d",
35 __entry->name,
36 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
37 __entry->nr_pages,
38 __entry->sync_mode,
39 __entry->for_kupdate,
40 __entry->range_cyclic,
41 __entry->for_background
42 )
43);
44#define DEFINE_WRITEBACK_WORK_EVENT(name) \
45DEFINE_EVENT(writeback_work_class, name, \
46 TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
47 TP_ARGS(bdi, work))
48DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread);
49DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
50DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
51
52TRACE_EVENT(writeback_pages_written,
53 TP_PROTO(long pages_written),
54 TP_ARGS(pages_written),
55 TP_STRUCT__entry(
56 __field(long, pages)
57 ),
58 TP_fast_assign(
59 __entry->pages = pages_written;
60 ),
61 TP_printk("%ld", __entry->pages)
62);
63
64DECLARE_EVENT_CLASS(writeback_class,
65 TP_PROTO(struct backing_dev_info *bdi),
66 TP_ARGS(bdi),
67 TP_STRUCT__entry(
68 __array(char, name, 32)
69 ),
70 TP_fast_assign(
71 strncpy(__entry->name, dev_name(bdi->dev), 32);
72 ),
73 TP_printk("bdi %s",
74 __entry->name
75 )
76);
77#define DEFINE_WRITEBACK_EVENT(name) \
78DEFINE_EVENT(writeback_class, name, \
79 TP_PROTO(struct backing_dev_info *bdi), \
80 TP_ARGS(bdi))
81
82DEFINE_WRITEBACK_EVENT(writeback_nowork);
83DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
84DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
85DEFINE_WRITEBACK_EVENT(writeback_thread_start);
86DEFINE_WRITEBACK_EVENT(writeback_thread_stop);
87
88#endif /* _TRACE_WRITEBACK_H */
89
90/* This part must be outside protection */
91#include <trace/define_trace.h>