Skip to content

Commit

Permalink
tracing: Add comment to describe special break case in probe_remove_e…
Browse files Browse the repository at this point in the history
…vent_call()

The "break" used in the do_for_each_event_file() is used as an optimization
as the loop is really a double loop. The loop searches all event files
for each trace_array. There's only one matching event file per trace_array
and after we find the event file for the trace_array, the break is used
to jump to the next trace_array and start the search there.

As this is not a standard way of using "break" in C code, it requires
a comment right before the break to let people know what is going on.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
rostedt committed Jul 31, 2013
1 parent 2816c55 commit 2ba6403
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,12 @@ static int probe_remove_event_call(struct ftrace_event_call *call)
*/
if (file->flags & FTRACE_EVENT_FL_ENABLED)
return -EBUSY;
/*
* The do_for_each_event_file_safe() is
* a double loop. After finding the call for this
* trace_array, we use break to jump to the next
* trace_array.
*/
break;
} while_for_each_event_file();

Expand Down

0 comments on commit 2ba6403

Please sign in to comment.