Skip to content

Commit b3bba87

Browse files
author
Wu Fengguang
committed
writeback: show writeback reason with __print_symbolic
This makes the binary trace understandable by trace-cmd. CC: Dave Chinner <david@fromorbit.com> CC: Curt Wohlgemuth <curtw@google.com> CC: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
1 parent 384703b commit b3bba87

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎fs/fs-writeback.c‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,6 @@ struct wb_writeback_work {
4747
struct completion *done; /* set if the caller waits */
4848
};
4949

50-
const char *wb_reason_name[] = {
51-
[WB_REASON_BACKGROUND] = "background",
52-
[WB_REASON_TRY_TO_FREE_PAGES] = "try_to_free_pages",
53-
[WB_REASON_SYNC] = "sync",
54-
[WB_REASON_PERIODIC] = "periodic",
55-
[WB_REASON_LAPTOP_TIMER] = "laptop_timer",
56-
[WB_REASON_FREE_MORE_MEM] = "free_more_memory",
57-
[WB_REASON_FS_FREE_SPACE] = "fs_free_space",
58-
[WB_REASON_FORKER_THREAD] = "forker_thread"
59-
};
60-
6150
/*
6251
* Include the creation of the trace points after defining the
6352
* wb_writeback_work structure so that the definition remains local to this

‎include/trace/events/writeback.h‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
{I_REFERENCED, "I_REFERENCED"} \
2222
)
2323

24+
#define WB_WORK_REASON \
25+
{WB_REASON_BACKGROUND, "background"}, \
26+
{WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \
27+
{WB_REASON_SYNC, "sync"}, \
28+
{WB_REASON_PERIODIC, "periodic"}, \
29+
{WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \
30+
{WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \
31+
{WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \
32+
{WB_REASON_FORKER_THREAD, "forker_thread"}
33+
2434
struct wb_writeback_work;
2535

2636
DECLARE_EVENT_CLASS(writeback_work_class,
@@ -55,7 +65,7 @@ DECLARE_EVENT_CLASS(writeback_work_class,
5565
__entry->for_kupdate,
5666
__entry->range_cyclic,
5767
__entry->for_background,
58-
wb_reason_name[__entry->reason]
68+
__print_symbolic(__entry->reason, WB_WORK_REASON)
5969
)
6070
);
6171
#define DEFINE_WRITEBACK_WORK_EVENT(name) \
@@ -184,7 +194,8 @@ TRACE_EVENT(writeback_queue_io,
184194
__entry->older, /* older_than_this in jiffies */
185195
__entry->age, /* older_than_this in relative milliseconds */
186196
__entry->moved,
187-
wb_reason_name[__entry->reason])
197+
__print_symbolic(__entry->reason, WB_WORK_REASON)
198+
)
188199
);
189200

190201
TRACE_EVENT(global_dirty_state,

0 commit comments

Comments
 (0)