diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-08-17 04:52:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-17 05:25:09 -0400 |
commit | 97d53202a5670a08b79c8ef2e4fff1c1ee21317c (patch) | |
tree | 5ba925559a3031a833c5803d05a0a43e13ea1866 /kernel/trace/trace_stat.c | |
parent | ba8b3a40ba7e06d00c27508f090803af90e8dbbf (diff) |
trace_stat: Fix missing entry in stat file
One entry is missing in the output of a stat file.
The cause is, when stat_seq_start() is called the 2nd time, we
should start from the (pos-1)th elem in the rbtree but not pos,
because pos == 0 is the header.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A891A65.70009@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace_stat.c')
-rw-r--r-- | kernel/trace/trace_stat.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c index 07c60b09258f..a4bb239eb987 100644 --- a/kernel/trace/trace_stat.c +++ b/kernel/trace/trace_stat.c | |||
@@ -203,17 +203,21 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos) | |||
203 | { | 203 | { |
204 | struct stat_session *session = s->private; | 204 | struct stat_session *session = s->private; |
205 | struct rb_node *node; | 205 | struct rb_node *node; |
206 | int n = *pos; | ||
206 | int i; | 207 | int i; |
207 | 208 | ||
208 | /* Prevent from tracer switch or rbtree modification */ | 209 | /* Prevent from tracer switch or rbtree modification */ |
209 | mutex_lock(&session->stat_mutex); | 210 | mutex_lock(&session->stat_mutex); |
210 | 211 | ||
211 | /* If we are in the beginning of the file, print the headers */ | 212 | /* If we are in the beginning of the file, print the headers */ |
212 | if (!*pos && session->ts->stat_headers) | 213 | if (session->ts->stat_headers) { |
213 | return SEQ_START_TOKEN; | 214 | if (n == 0) |
215 | return SEQ_START_TOKEN; | ||
216 | n--; | ||
217 | } | ||
214 | 218 | ||
215 | node = rb_first(&session->stat_root); | 219 | node = rb_first(&session->stat_root); |
216 | for (i = 0; node && i < *pos; i++) | 220 | for (i = 0; node && i < n; i++) |
217 | node = rb_next(node); | 221 | node = rb_next(node); |
218 | 222 | ||
219 | return node; | 223 | return node; |