tracing: Pass the ftrace_file to the buffer lock reserve code
authorSteven Rostedt <srostedt@redhat.com>
Thu, 2 Aug 2012 14:32:10 +0000 (10:32 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 15 Mar 2013 04:34:42 +0000 (00:34 -0400)
Pass the struct ftrace_event_file *ftrace_file to the
trace_event_buffer_lock_reserve() (new function that replaces the
trace_current_buffer_lock_reserver()).

The ftrace_file holds a pointer to the trace_array that is in use.
In the case of multiple buffers with different trace_arrays, this
allows different events to be recorded into different buffers.

Also fixed some of the stale comments in include/trace/ftrace.h

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
include/linux/ftrace_event.h
include/trace/ftrace.h
kernel/trace/trace.c

index c7191d482f98cdb0b6bb6d4f6a2c64e49861922c..fd28c170c597797bcb23e5d8217f78f1e85f809b 100644 (file)
@@ -128,6 +128,13 @@ enum print_line_t {
 void tracing_generic_entry_update(struct trace_entry *entry,
                                  unsigned long flags,
                                  int pc);
+struct ftrace_event_file;
+
+struct ring_buffer_event *
+trace_event_buffer_lock_reserve(struct ring_buffer **current_buffer,
+                               struct ftrace_event_file *ftrace_file,
+                               int type, unsigned long len,
+                               unsigned long flags, int pc);
 struct ring_buffer_event *
 trace_current_buffer_lock_reserve(struct ring_buffer **current_buffer,
                                  int type, unsigned long len,
index 191d9661e277058abb5f29a7a8b8a1319f339b10..e5d140a91fd742f466c792594b03149761de304e 100644 (file)
@@ -414,7 +414,8 @@ static inline notrace int ftrace_get_offsets_##call(                        \
  *
  * static void ftrace_raw_event_<call>(void *__data, proto)
  * {
- *     struct ftrace_event_call *event_call = __data;
+ *     struct ftrace_event_file *ftrace_file = __data;
+ *     struct ftrace_event_call *event_call = ftrace_file->event_call;
  *     struct ftrace_data_offsets_<call> __maybe_unused __data_offsets;
  *     struct ring_buffer_event *event;
  *     struct ftrace_raw_<call> *entry; <-- defined in stage 1
@@ -428,7 +429,7 @@ static inline notrace int ftrace_get_offsets_##call(                        \
  *
  *     __data_size = ftrace_get_offsets_<call>(&__data_offsets, args);
  *
- *     event = trace_current_buffer_lock_reserve(&buffer,
+ *     event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,
  *                               event_<call>->event.type,
  *                               sizeof(*entry) + __data_size,
  *                               irq_flags, pc);
@@ -440,7 +441,7 @@ static inline notrace int ftrace_get_offsets_##call(                        \
  *                        __array macros.
  *
  *     if (!filter_current_check_discard(buffer, event_call, entry, event))
- *             trace_current_buffer_unlock_commit(buffer,
+ *             trace_nowake_buffer_unlock_commit(buffer,
  *                                                event, irq_flags, pc);
  * }
  *
@@ -533,7 +534,7 @@ ftrace_raw_event_##call(void *__data, proto)                                \
                                                                        \
        __data_size = ftrace_get_offsets_##call(&__data_offsets, args); \
                                                                        \
-       event = trace_current_buffer_lock_reserve(&buffer,              \
+       event = trace_event_buffer_lock_reserve(&buffer, ftrace_file,   \
                                 event_call->event.type,                \
                                 sizeof(*entry) + __data_size,          \
                                 irq_flags, pc);                        \
index 91fe40905828af88badcd0d9141df101221ff121..29bff72f97ef2aba327546a40ad10f43b76164c7 100644 (file)
@@ -1293,6 +1293,18 @@ void trace_buffer_unlock_commit(struct ring_buffer *buffer,
 }
 EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
 
+struct ring_buffer_event *
+trace_event_buffer_lock_reserve(struct ring_buffer **current_rb,
+                         struct ftrace_event_file *ftrace_file,
+                         int type, unsigned long len,
+                         unsigned long flags, int pc)
+{
+       *current_rb = ftrace_file->tr->buffer;
+       return trace_buffer_lock_reserve(*current_rb,
+                                        type, len, flags, pc);
+}
+EXPORT_SYMBOL_GPL(trace_event_buffer_lock_reserve);
+
 struct ring_buffer_event *
 trace_current_buffer_lock_reserve(struct ring_buffer **current_rb,
                                  int type, unsigned long len,