]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tracing: Free up file->private_data for use by individual events
authorPetr Pavlu <petr.pavlu@suse.com>
Thu, 19 Feb 2026 16:27:05 +0000 (17:27 +0100)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 24 Mar 2026 00:16:46 +0000 (20:16 -0400)
The tracing_open_file_tr() function currently copies the trace_event_file
pointer from inode->i_private to file->private_data when the file is
successfully opened. This duplication is not particularly useful, as all
event code should utilize event_file_file() or event_file_data() to
retrieve a trace_event_file pointer from a file struct and these access
functions read file->f_inode->i_private. Moreover, this setup requires the
code for opening hist files to explicitly clear file->private_data before
calling single_open(), since this function expects the private_data member
to be set to NULL and uses it to store a pointer to a seq_file.

Remove the unnecessary setting of file->private_data in
tracing_open_file_tr() and simplify the hist code.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Link: https://patch.msgid.link/20260219162737.314231-6-petr.pavlu@suse.com
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace.c
kernel/trace/trace_events_hist.c

index a626211ceb9a8b3bb0ff4dd7580a89ef1e03b45b..cf48fe23e71f00b4bba2b3bc9750eea5b36fbae9 100644 (file)
@@ -4050,8 +4050,6 @@ int tracing_open_file_tr(struct inode *inode, struct file *filp)
                event_file_get(file);
        }
 
-       filp->private_data = inode->i_private;
-
        return 0;
 }
 
index 73ea180cad555898693e92ee397a1c9493c7c167..67cb9231086455d8082ac6e187bdec314c94915b 100644 (file)
@@ -5836,8 +5836,6 @@ static int event_hist_open(struct inode *inode, struct file *file)
        hist_file->file = file;
        hist_file->last_act = get_hist_hit_count(event_file);
 
-       /* Clear private_data to avoid warning in single_open() */
-       file->private_data = NULL;
        ret = single_open(file, hist_show, hist_file);
        if (ret) {
                kfree(hist_file);
@@ -6126,8 +6124,6 @@ static int event_hist_debug_open(struct inode *inode, struct file *file)
        if (ret)
                return ret;
 
-       /* Clear private_data to avoid warning in single_open() */
-       file->private_data = NULL;
        ret = single_open(file, hist_debug_show, file);
        if (ret)
                tracing_release_file_tr(inode, file);