Skip to content

Commit

Permalink
tracing: Fold filter_check_discard() into its only user
Browse files Browse the repository at this point in the history
The function filter_check_discard() is small and only called by one user,
its code can be folded into that one caller and make the code a bit less
comlplex.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt (Red Hat) committed Apr 29, 2016
1 parent 65da9a0 commit 9cbb150
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
13 changes: 0 additions & 13 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,6 @@ void trace_array_put(struct trace_array *this_tr)
mutex_unlock(&trace_types_lock);
}

int filter_check_discard(struct trace_event_file *file, void *rec,
struct ring_buffer *buffer,
struct ring_buffer_event *event)
{
if (unlikely(file->flags & EVENT_FILE_FL_FILTERED) &&
!filter_match_preds(file->filter, rec)) {
ring_buffer_discard_commit(buffer, event);
return 1;
}

return 0;
}

int call_filter_check_discard(struct trace_event_call *call, void *rec,
struct ring_buffer *buffer,
struct ring_buffer_event *event)
Expand Down
13 changes: 6 additions & 7 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1065,9 +1065,6 @@ struct trace_subsystem_dir {
int nr_events;
};

extern int filter_check_discard(struct trace_event_file *file, void *rec,
struct ring_buffer *buffer,
struct ring_buffer_event *event);
extern int call_filter_check_discard(struct trace_event_call *call, void *rec,
struct ring_buffer *buffer,
struct ring_buffer_event *event);
Expand Down Expand Up @@ -1096,12 +1093,14 @@ __event_trigger_test_discard(struct trace_event_file *file,
if (eflags & EVENT_FILE_FL_TRIGGER_COND)
*tt = event_triggers_call(file, entry);

if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags))
if (test_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags) ||
(unlikely(file->flags & EVENT_FILE_FL_FILTERED) &&
!filter_match_preds(file->filter, entry))) {
ring_buffer_discard_commit(buffer, event);
else if (!filter_check_discard(file, entry, buffer, event))
return false;
return true;
}

return true;
return false;
}

/**
Expand Down

0 comments on commit 9cbb150

Please sign in to comment.