Skip to contentSkip to conversation

tracing: Remove 'dir' from trace_event_file structure

PATCH New Steven Rostedt 1 participant 3 messages Sep 8, 2023 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover tracing: Remove 'dir' from trace_event_file structure

The dir field is no longer used by the trace_event_file structure as it was replaced by the tracefs 'ef' field. This caused a bug to keep the "print" event from getting the "trigger" added to it.

Steven Rostedt (Google) (2):
tracing: Use the new eventfs descriptor for print trigger
tracing: Remove unused trace_event_file dir field

----

 include/linux/trace_events.h |  1 -
 kernel/trace/trace.c         |  4 ++--
 kernel/trace/trace_events.c  | 13 -------------
 3 files changed, 2 insertions(+), 16 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 tracing: Use the new eventfs descriptor for print trigger

From: "Steven Rostedt (Google)" <[email protected]>

The check to create the print event "trigger" was using the obsolete "dir" value of the trace_event_file to determine if it should create the trigger or not. But that value will now be NULL because it uses the event file descriptor.

Change it to test the "ef" field of the trace_event_file structure so that the trace_marker "trigger" file appears again.

Fixes 27152bceea1df ("eventfs: Move tracing/events to eventfs")
---
 kernel/trace/trace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/trace.c +2 -2
index 0608ad20cf30..122c23c9eb28 100644
@@ -9792,8 +9792,8 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
 			  tr, &tracing_mark_fops);
 
 	file = __find_event_file(tr, "ftrace", "print");
-	if (file && file->dir)
-		trace_create_file("trigger", TRACE_MODE_WRITE, file->dir,
+	if (file && file->ef)
+		eventfs_add_file("trigger", TRACE_MODE_WRITE, file->ef,
 				  file, &event_trigger_fops);
 	tr->trace_marker_file = file;
 
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH 2/2 tracing: Remove unused trace_event_file dir field

In reply to Steven Rostedt

From: "Steven Rostedt (Google)" <[email protected]>

Now that eventfs structure is used to create the events directory via the eventfs dynamically allocate code, the "dir" field of the trace_event_file structure is no longer used. Remove it.

---
 include/linux/trace_events.h |  1 -
 kernel/trace/trace_events.c  | 13 -------------
 2 files changed, 14 deletions(-)
include/linux/trace_events.h +0 -1
index eb5c3add939b..12f875e9e69a 100644
@@ -650,7 +650,6 @@ struct trace_event_file {
 	struct trace_event_call		*event_call;
 	struct event_filter __rcu	*filter;
 	struct eventfs_file             *ef;
-	struct dentry			*dir;
 	struct trace_array		*tr;
 	struct trace_subsystem_dir	*system;
 	struct list_head		triggers;
kernel/trace/trace_events.c +0 -13
index 2af92177b765..065c63991858 100644
@@ -992,19 +992,6 @@ static void remove_subsystem(struct trace_subsystem_dir *dir)
 
 static void remove_event_file_dir(struct trace_event_file *file)
 {
-	struct dentry *dir = file->dir;
-	struct dentry *child;
-
-	if (dir) {
-		spin_lock(&dir->d_lock);	/* probably unneeded */
-		list_for_each_entry(child, &dir->d_subdirs, d_child) {
-			if (d_really_is_positive(child))	/* probably unneeded */
-				d_inode(child)->i_private = NULL;
-		}
-		spin_unlock(&dir->d_lock);
-
-		tracefs_remove(dir);
-	}
 	eventfs_remove(file->ef);
 	list_del(&file->list);
 	remove_subsystem(file->system);
Signature · 1 line
2.40.1