diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-01-21 15:01:39 (GMT) |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-02-03 17:48:43 (GMT) |
commit | eae473581cf93dad94ca833aa961c033c6a43924 (patch) | |
tree | ea0a8bbf8a30940b497dad43a858be8d1b5efb26 /include | |
parent | cc31004a4aa784d89054ec07b87eae05cecf7121 (diff) | |
download | linux-eae473581cf93dad94ca833aa961c033c6a43924.tar.xz |
tracing: Have mkdir and rmdir be part of tracefs
The tracing "instances" directory can create sub tracing buffers
with mkdir, and remove them with rmdir. As a mkdir will also create
all the files and directories that control the sub buffer the inode
mutexes need to be released before this is done, to avoid deadlocks.
It is better to let the tracing system unlock the inode mutexes before
calling the functions that create the files within the new directory
(or deletes the files from the one being destroyed).
Now that tracing has been converted over to tracefs, the tracefs file
system can be modified to accommodate this feature. It still releases
the locks, but the filesystem itself can take care of the ugly
business and let the user just do what it needs.
The tracing system now attaches a descriptor to the directory dentry
that can have userspace create or remove sub directories. If this
descriptor does not exist for a dentry, then that dentry can not be
used to create other directories. This descriptor holds a mkdir and
rmdir method that only takes a character string as an argument.
The tracefs file system will first make a copy of the dentry name
before releasing the locks. Then it will pass the copied name to the
methods. It is up to the tracing system that supplied the methods to
handle races with duplicate names and such as all the inode mutexes
would be released when the functions are called.
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tracefs.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h index 23e04ce..5b727a1 100644 --- a/include/linux/tracefs.h +++ b/include/linux/tracefs.h @@ -34,6 +34,10 @@ struct dentry *tracefs_create_dir(const char *name, struct dentry *parent); void tracefs_remove(struct dentry *dentry); void tracefs_remove_recursive(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 */ |