Commit 823e545c authored by Amir Goldstein's avatar Amir Goldstein Committed by Jan Kara

debugfs: simplify __debugfs_remove_file()

Move simple_unlink()+d_delete() from __debugfs_remove_file() into
caller __debugfs_remove() and rename helper for post remove file to
__debugfs_file_removed().

This will simplify adding fsnotify_unlink() hook.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent fd0d506f
...@@ -617,13 +617,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, ...@@ -617,13 +617,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
} }
EXPORT_SYMBOL_GPL(debugfs_create_symlink); EXPORT_SYMBOL_GPL(debugfs_create_symlink);
static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent) static void __debugfs_file_removed(struct dentry *dentry)
{ {
struct debugfs_fsdata *fsd; struct debugfs_fsdata *fsd;
simple_unlink(d_inode(parent), dentry);
d_delete(dentry);
/* /*
* Paired with the closing smp_mb() implied by a successful * Paired with the closing smp_mb() implied by a successful
* cmpxchg() in debugfs_file_get(): either * cmpxchg() in debugfs_file_get(): either
...@@ -644,16 +641,15 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) ...@@ -644,16 +641,15 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
if (simple_positive(dentry)) { if (simple_positive(dentry)) {
dget(dentry); dget(dentry);
if (!d_is_reg(dentry)) { if (d_is_dir(dentry)) {
if (d_is_dir(dentry)) ret = simple_rmdir(d_inode(parent), dentry);
ret = simple_rmdir(d_inode(parent), dentry);
else
simple_unlink(d_inode(parent), dentry);
if (!ret)
d_delete(dentry);
} else { } else {
__debugfs_remove_file(dentry, parent); simple_unlink(d_inode(parent), dentry);
} }
if (!ret)
d_delete(dentry);
if (d_is_reg(dentry))
__debugfs_file_removed(dentry);
dput(dentry); dput(dentry);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment