1 ext4: improve extents status tree trace point
3 From: Zheng Liu <wenqing.lz@taobao.com>
5 This commit improves the trace point of extents status tree. We rename
6 trace_ext4_es_shrink_enter in ext4_es_count() because it is also used
7 in ext4_es_scan() and we can not identify them from the result.
9 Further this commit fixes a variable name in trace point in order to
10 keep consistency with others.
12 Cc: Andreas Dilger <adilger.kernel@dilger.ca>
13 Cc: Jan Kara <jack@suse.cz>
14 Reviewed-by: Jan Kara <jack@suse.cz>
15 Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
16 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
18 fs/ext4/extents_status.c | 6 +++---
19 include/trace/events/ext4.h | 28 ++++++++++++++++++++--------
20 2 files changed, 23 insertions(+), 11 deletions(-)
22 diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
23 index 0b7e28e..47d60dc 100644
24 --- a/fs/ext4/extents_status.c
25 +++ b/fs/ext4/extents_status.c
26 @@ -1021,7 +1021,7 @@ static unsigned long ext4_es_count(struct shrinker *shrink,
28 sbi = container_of(shrink, struct ext4_sb_info, s_es_shrinker);
29 nr = percpu_counter_read_positive(&sbi->s_extent_cache_cnt);
30 - trace_ext4_es_shrink_enter(sbi->s_sb, sc->nr_to_scan, nr);
31 + trace_ext4_es_shrink_count(sbi->s_sb, sc->nr_to_scan, nr);
35 @@ -1034,14 +1034,14 @@ static unsigned long ext4_es_scan(struct shrinker *shrink,
38 ret = percpu_counter_read_positive(&sbi->s_extent_cache_cnt);
39 - trace_ext4_es_shrink_enter(sbi->s_sb, nr_to_scan, ret);
40 + trace_ext4_es_shrink_scan_enter(sbi->s_sb, nr_to_scan, ret);
45 nr_shrunk = __ext4_es_shrink(sbi, nr_to_scan, NULL);
47 - trace_ext4_es_shrink_exit(sbi->s_sb, nr_shrunk, ret);
48 + trace_ext4_es_shrink_scan_exit(sbi->s_sb, nr_shrunk, ret);
52 diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
53 index d4f70a7..849aaba 100644
54 --- a/include/trace/events/ext4.h
55 +++ b/include/trace/events/ext4.h
56 @@ -2369,7 +2369,7 @@ TRACE_EVENT(ext4_es_lookup_extent_exit,
57 show_extent_status(__entry->found ? __entry->status : 0))
60 -TRACE_EVENT(ext4_es_shrink_enter,
61 +DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
62 TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
64 TP_ARGS(sb, nr_to_scan, cache_cnt),
65 @@ -2391,26 +2391,38 @@ TRACE_EVENT(ext4_es_shrink_enter,
66 __entry->nr_to_scan, __entry->cache_cnt)
69 -TRACE_EVENT(ext4_es_shrink_exit,
70 - TP_PROTO(struct super_block *sb, int shrunk_nr, int cache_cnt),
71 +DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
72 + TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
74 + TP_ARGS(sb, nr_to_scan, cache_cnt)
77 +DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
78 + TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
80 + TP_ARGS(sb, nr_to_scan, cache_cnt)
83 +TRACE_EVENT(ext4_es_shrink_scan_exit,
84 + TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
86 - TP_ARGS(sb, shrunk_nr, cache_cnt),
87 + TP_ARGS(sb, nr_shrunk, cache_cnt),
91 - __field( int, shrunk_nr )
92 + __field( int, nr_shrunk )
93 __field( int, cache_cnt )
97 __entry->dev = sb->s_dev;
98 - __entry->shrunk_nr = shrunk_nr;
99 + __entry->nr_shrunk = nr_shrunk;
100 __entry->cache_cnt = cache_cnt;
103 - TP_printk("dev %d,%d shrunk_nr %d cache_cnt %d",
104 + TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
105 MAJOR(__entry->dev), MINOR(__entry->dev),
106 - __entry->shrunk_nr, __entry->cache_cnt)
107 + __entry->nr_shrunk, __entry->cache_cnt)
110 TRACE_EVENT(ext4_collapse_range,