Skip to content

Commit

Permalink
ftrace: Unify effect of writing to trace_options and option/*
Browse files Browse the repository at this point in the history
"echo noglobal-clock > trace_options" can be used to change trace
clock but "echo 0 > options/global-clock" can't. The flag toggling
will be silently accepted without actually changing the clock callback.

We can fix it by using set_tracer_flags() in
trace_options_core_write().

Changelog:
v1->v2: Simplified switch() after Li Zefan <lizf@cn.fujitsu.com>'s
        suggestion

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: Steven Rostedt <srostedt@redhat.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
  • Loading branch information
Zhaolei authored and Frederic Weisbecker committed Aug 18, 2009
1 parent df4ecf1 commit f2d84b6
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3896,17 +3896,9 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt,
if (ret < 0)
return ret;

switch (val) {
case 0:
trace_flags &= ~(1 << index);
break;
case 1:
trace_flags |= 1 << index;
break;

default:
if (val != 0 && val != 1)
return -EINVAL;
}
set_tracer_flags(1 << index, val);

*ppos += cnt;

Expand Down

0 comments on commit f2d84b6

Please sign in to comment.