Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121125
b: refs/heads/master
c: 982c350
h: refs/heads/master
i:
  121123: 42a9cd3
v: v3
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Nov 16, 2008
1 parent d58f640 commit 0ca372b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 48 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 20e5227e9f55ae1969934821ccbf581563785bbe
refs/heads/master: 982c350b9ec4b3564d67f3627a274ae61bbc7e95
83 changes: 36 additions & 47 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,72 +394,62 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable)

ip = rec->ip;

if (ftrace_filtered && enable) {
/*
* If this record is not to be traced and
* it is not enabled then do nothing.
*
* If this record is not to be traced and
* it is enabled then disabled it.
*
*/
if (rec->flags & FTRACE_FL_NOTRACE) {
if (rec->flags & FTRACE_FL_ENABLED)
rec->flags &= ~FTRACE_FL_ENABLED;
else
return 0;

} else if (ftrace_filtered && enable) {
/*
* If filtering is on:
*
* If this record is set to be filtered and
* is enabled then do nothing.
*
* If this record is set to be filtered and
* it is not enabled, enable it.
*
* If this record is not set to be filtered
* and it is not enabled do nothing.
*
* If this record is set not to trace then
* do nothing.
*
* If this record is set not to trace and
* it is enabled then disable it.
*
* If this record is not set to be filtered and
* it is enabled, disable it.
* Filtering is on:
*/

fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE |
FTRACE_FL_ENABLED);
fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_ENABLED);

if ((fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED)) ||
(fl == (FTRACE_FL_FILTER | FTRACE_FL_NOTRACE)) ||
!fl || (fl == FTRACE_FL_NOTRACE))
/* Record is filtered and enabled, do nothing */
if (fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED))
return 0;

/*
* If it is enabled disable it,
* otherwise enable it!
*/
if (fl & FTRACE_FL_ENABLED) {
enable = 0;
/* Record is not filtered and is not enabled do nothing */
if (!fl)
return 0;

/* Record is not filtered but enabled, disable it */
if (fl == FTRACE_FL_ENABLED)
rec->flags &= ~FTRACE_FL_ENABLED;
} else {
enable = 1;
else
/* Otherwise record is filtered but not enabled, enable it */
rec->flags |= FTRACE_FL_ENABLED;
}
} else {
/* Disable or not filtered */

if (enable) {
/*
* If this record is set not to trace and is
* not enabled, do nothing.
*/
fl = rec->flags & (FTRACE_FL_NOTRACE | FTRACE_FL_ENABLED);
if (fl == FTRACE_FL_NOTRACE)
return 0;
}

if (enable) {
/* if record is enabled, do nothing */
if (rec->flags & FTRACE_FL_ENABLED)
return 0;

rec->flags |= FTRACE_FL_ENABLED;

} else {

/* if record is not enabled do nothing */
if (!(rec->flags & FTRACE_FL_ENABLED))
return 0;

rec->flags &= ~FTRACE_FL_ENABLED;
}
}

if (enable)
if (rec->flags & FTRACE_FL_ENABLED)
return ftrace_make_call(rec, FTRACE_ADDR);
else
return ftrace_make_nop(NULL, rec, FTRACE_ADDR);
Expand Down Expand Up @@ -554,8 +544,7 @@ static void ftrace_startup(void)

mutex_lock(&ftrace_start_lock);
ftrace_start_up++;
if (ftrace_start_up == 1)
command |= FTRACE_ENABLE_CALLS;
command |= FTRACE_ENABLE_CALLS;

if (saved_ftrace_func != ftrace_trace_function) {
saved_ftrace_func = ftrace_trace_function;
Expand Down

0 comments on commit 0ca372b

Please sign in to comment.