Skip to content

Commit

Permalink
ftrace: Move record update for normal and modules into a separate fun…
Browse files Browse the repository at this point in the history
…ction

The updating of a function record is moved to a single function. This will allow
us to add specific changes in one location for both modules and kernel
functions.

Later patches will determine if the function record itself needs to be updated
(which enables the mcount caller), or just the ftrace_ops needs the update.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Apr 30, 2011
1 parent d2c8c3e commit 996e87b
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,15 @@ static int ftrace_match(char *str, char *regex, int len, int type)
return matched;
}

static void
update_record(struct dyn_ftrace *rec, unsigned long flag, int not)
{
if (not)
rec->flags &= ~flag;
else
rec->flags |= flag;
}

static int
ftrace_match_record(struct dyn_ftrace *rec, char *regex, int len, int type)
{
Expand Down Expand Up @@ -1772,10 +1781,7 @@ static int ftrace_match_records(char *buff, int len, int enable)
do_for_each_ftrace_rec(pg, rec) {

if (ftrace_match_record(rec, search, search_len, type)) {
if (not)
rec->flags &= ~flag;
else
rec->flags |= flag;
update_record(rec, flag, not);
found = 1;
}
/*
Expand Down Expand Up @@ -1846,10 +1852,7 @@ static int ftrace_match_module_records(char *buff, char *mod, int enable)

if (ftrace_match_module_record(rec, mod,
search, search_len, type)) {
if (not)
rec->flags &= ~flag;
else
rec->flags |= flag;
update_record(rec, flag, not);
found = 1;
}
if (enable && (rec->flags & FTRACE_FL_FILTER))
Expand Down

0 comments on commit 996e87b

Please sign in to comment.