Re: [PATCH 6/6] eventfs: clean up dentry ops and add revalidate function

Steven Rostedt
2024-01-31T23:23:40Z

On Thu, 1 Feb 2024 08:07:15 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> > Then tracefs could be nicely converted over to kernfs, and eventfs would be
> > its own entity.
>
> If so, maybe we can just make symlinks to the 'id' and 'format' from events
> under tracefs? :)

I don't think that will save anything. The files currently do not allocate
any memory. If we make symlinks, we need to allocate a path, to them. I
think that would be rather difficult to do. Not to mention, that could
cause a lot of breakage. What do you do if the other filesystem isn't
mounted?

I could possibly make a light way handle to pass back to the callbacks.

struct trace_event_light {
unsigned long flags
struct trace_event_call *event_call;
};

struct trace_event_file {
struct trace_event_light call;
[..]
// Remove he flags and event_call and have it above
};

if the callback data has:

callback(..., void **data)
{
struct trace_event_light *call = *data;
struct trace_event_file *file;

If (strcmp(name, "id") == 0 || strcmp(name, "format") == 0) {
*data = call->event_call;
return 1;
}

/* Return if this is just a light data entry */
if (!(data->flags & TRACE_EVENT_FULL))
return 0;

file = container_of(data, struct trace_event_file, call);

// continue processing the full data
}

This way the lonely eventfs could still share a lot of the code.

-- Steve