mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-28 20:02:17 +00:00
![Ajay Kaher](/assets/img/avatar_default.png)
When events are removed from tracefs, the eventfs must be aware of this. The eventfs_remove() removes the meta data from eventfs so that it will no longer create the files associated with that event. When an instance is removed from tracefs, eventfs_remove_events_dir() will remove and clean up the entire "events" directory. The helper function eventfs_remove_rec() is used to clean up and free the associated data from eventfs for both of the added functions. SRCU is used to protect the lists of meta data stored in the eventfs. The eventfs_mutex is used to protect the content of the items in the list. As lookups may be happening as deletions of events are made, the freeing of dentry/inodes and relative information is done after the SRCU grace period has passed. Link: https://lkml.kernel.org/r/1690568452-46553-9-git-send-email-akaher@vmware.com Signed-off-by: Ajay Kaher <akaher@vmware.com> Co-developed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Tested-by: Ching-lin Yu <chinglinyu@google.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202305030611.Kas747Ev-lkp@intel.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* tracefs.h - a pseudo file system for activating tracing
|
|
*
|
|
* Based on debugfs by: 2004 Greg Kroah-Hartman <greg@kroah.com>
|
|
*
|
|
* Copyright (C) 2014 Red Hat Inc, author: Steven Rostedt <srostedt@redhat.com>
|
|
*
|
|
* tracefs is the file system that is used by the tracing infrastructure.
|
|
*/
|
|
|
|
#ifndef _TRACEFS_H_
|
|
#define _TRACEFS_H_
|
|
|
|
#include <linux/fs.h>
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct file_operations;
|
|
|
|
#ifdef CONFIG_TRACING
|
|
|
|
struct eventfs_file;
|
|
|
|
struct dentry *eventfs_create_events_dir(const char *name,
|
|
struct dentry *parent);
|
|
|
|
struct eventfs_file *eventfs_add_subsystem_dir(const char *name,
|
|
struct dentry *parent);
|
|
|
|
struct eventfs_file *eventfs_add_dir(const char *name,
|
|
struct eventfs_file *ef_parent);
|
|
|
|
int eventfs_add_file(const char *name, umode_t mode,
|
|
struct eventfs_file *ef_parent, void *data,
|
|
const struct file_operations *fops);
|
|
|
|
int eventfs_add_events_file(const char *name, umode_t mode,
|
|
struct dentry *parent, void *data,
|
|
const struct file_operations *fops);
|
|
|
|
void eventfs_remove(struct eventfs_file *ef);
|
|
|
|
void eventfs_remove_events_dir(struct dentry *dentry);
|
|
|
|
struct dentry *tracefs_create_file(const char *name, umode_t mode,
|
|
struct dentry *parent, void *data,
|
|
const struct file_operations *fops);
|
|
|
|
struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
|
|
|
|
void tracefs_remove(struct dentry *dentry);
|
|
|
|
struct dentry *tracefs_create_instance_dir(const char *name, struct dentry *parent,
|
|
int (*mkdir)(const char *name),
|
|
int (*rmdir)(const char *name));
|
|
|
|
bool tracefs_initialized(void);
|
|
|
|
#endif /* CONFIG_TRACING */
|
|
|
|
#endif
|