-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Dave Chinner
authored and
Jens Axboe
committed
Aug 7, 2010
1 parent
a89f5c8
commit 455b286
Showing
3 changed files
with
124 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#undef TRACE_SYSTEM | ||
#define TRACE_SYSTEM writeback | ||
|
||
#if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) | ||
#define _TRACE_WRITEBACK_H | ||
|
||
#include <linux/backing-dev.h> | ||
#include <linux/writeback.h> | ||
|
||
struct wb_writeback_work; | ||
|
||
DECLARE_EVENT_CLASS(writeback_work_class, | ||
TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), | ||
TP_ARGS(bdi, work), | ||
TP_STRUCT__entry( | ||
__array(char, name, 32) | ||
__field(long, nr_pages) | ||
__field(dev_t, sb_dev) | ||
__field(int, sync_mode) | ||
__field(int, for_kupdate) | ||
__field(int, range_cyclic) | ||
__field(int, for_background) | ||
), | ||
TP_fast_assign( | ||
strncpy(__entry->name, dev_name(bdi->dev), 32); | ||
__entry->nr_pages = work->nr_pages; | ||
__entry->sb_dev = work->sb ? work->sb->s_dev : 0; | ||
__entry->sync_mode = work->sync_mode; | ||
__entry->for_kupdate = work->for_kupdate; | ||
__entry->range_cyclic = work->range_cyclic; | ||
__entry->for_background = work->for_background; | ||
), | ||
TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " | ||
"kupdate=%d range_cyclic=%d background=%d", | ||
__entry->name, | ||
MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), | ||
__entry->nr_pages, | ||
__entry->sync_mode, | ||
__entry->for_kupdate, | ||
__entry->range_cyclic, | ||
__entry->for_background | ||
) | ||
); | ||
#define DEFINE_WRITEBACK_WORK_EVENT(name) \ | ||
DEFINE_EVENT(writeback_work_class, name, \ | ||
TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ | ||
TP_ARGS(bdi, work)) | ||
DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread); | ||
DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); | ||
DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); | ||
|
||
TRACE_EVENT(writeback_pages_written, | ||
TP_PROTO(long pages_written), | ||
TP_ARGS(pages_written), | ||
TP_STRUCT__entry( | ||
__field(long, pages) | ||
), | ||
TP_fast_assign( | ||
__entry->pages = pages_written; | ||
), | ||
TP_printk("%ld", __entry->pages) | ||
); | ||
|
||
DECLARE_EVENT_CLASS(writeback_class, | ||
TP_PROTO(struct backing_dev_info *bdi), | ||
TP_ARGS(bdi), | ||
TP_STRUCT__entry( | ||
__array(char, name, 32) | ||
), | ||
TP_fast_assign( | ||
strncpy(__entry->name, dev_name(bdi->dev), 32); | ||
), | ||
TP_printk("bdi %s", | ||
__entry->name | ||
) | ||
); | ||
#define DEFINE_WRITEBACK_EVENT(name) \ | ||
DEFINE_EVENT(writeback_class, name, \ | ||
TP_PROTO(struct backing_dev_info *bdi), \ | ||
TP_ARGS(bdi)) | ||
|
||
DEFINE_WRITEBACK_EVENT(writeback_nowork); | ||
DEFINE_WRITEBACK_EVENT(writeback_bdi_register); | ||
DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | ||
DEFINE_WRITEBACK_EVENT(writeback_thread_start); | ||
DEFINE_WRITEBACK_EVENT(writeback_thread_stop); | ||
|
||
#endif /* _TRACE_WRITEBACK_H */ | ||
|
||
/* This part must be outside protection */ | ||
#include <trace/define_trace.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters