ftrace: Don't manipulate @pos in t_start()
authorLi Zefan <lizf@cn.fujitsu.com>
Wed, 24 Jun 2009 01:54:19 +0000 (09:54 +0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 24 Jun 2009 09:02:53 +0000 (11:02 +0200)
commit694ce0a544fba37a60025a6803ee6265be8a2a22
treea6debd92de0dcf7b42dc129402ca793c540091ae
parent85951842a1020669f0a9eb0f0d1853b41341f097
ftrace: Don't manipulate @pos in t_start()

It's rather confusing that in t_start(), in some cases @pos is
incremented, and in some cases it's decremented and then incremented.

This patch rewrites t_start() in a much more general way.

Thus we fix a bug that if ftrace_filtered == 1, functions have tracer
hooks won't be printed, because the branch is always unreachable:

static void *t_start(...)
{
...
if (!p)
return t_hash_start(m, pos);
return p;
}

Before:
  # echo 'sys_open' > /mnt/tracing/set_ftrace_filter
  # echo 'sys_write:traceon:4' >> /mnt/tracing/set_ftrace_filter
  sys_open

After:
  # echo 'sys_open' > /mnt/tracing/set_ftrace_filter
  # echo 'sys_write:traceon:4' >> /mnt/tracing/set_ftrace_filter
  sys_open
  sys_write:traceon:count=4

Reviewed-by: Liming Wang <liming.wang@windriver.com>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4A41874B.4090507@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/ftrace.c