Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Free up file->private_data for use by individual events

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>

authored by

Petr Pavlu and committed by
Steven Rostedt (Google)
f54f08b1 f0eaed27

-6
-2
kernel/trace/trace.c
··· 4050 4050 event_file_get(file); 4051 4051 } 4052 4052 4053 - filp->private_data = inode->i_private; 4054 - 4055 4053 return 0; 4056 4054 } 4057 4055
-4
kernel/trace/trace_events_hist.c
··· 5836 5836 hist_file->file = file; 5837 5837 hist_file->last_act = get_hist_hit_count(event_file); 5838 5838 5839 - /* Clear private_data to avoid warning in single_open() */ 5840 - file->private_data = NULL; 5841 5839 ret = single_open(file, hist_show, hist_file); 5842 5840 if (ret) { 5843 5841 kfree(hist_file); ··· 6124 6126 if (ret) 6125 6127 return ret; 6126 6128 6127 - /* Clear private_data to avoid warning in single_open() */ 6128 - file->private_data = NULL; 6129 6129 ret = single_open(file, hist_debug_show, file); 6130 6130 if (ret) 6131 6131 tracing_release_file_tr(inode, file);