diff options
author | Amir Goldstein <amir73il@gmail.com> | 2019-05-26 10:34:07 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-06-20 08:46:42 -0400 |
commit | 823e545c027795997f29ec5c255aff605cf39e85 (patch) | |
tree | 4e2b80188d1b6d9ac338b9120aaf49f10c3e1c06 | |
parent | fd0d506f2b8247b3defcca2723622e404fb55c64 (diff) |
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/debugfs/inode.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index acef14ad53db..d89874da9791 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -617,13 +617,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, | |||
617 | } | 617 | } |
618 | EXPORT_SYMBOL_GPL(debugfs_create_symlink); | 618 | EXPORT_SYMBOL_GPL(debugfs_create_symlink); |
619 | 619 | ||
620 | static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent) | 620 | static void __debugfs_file_removed(struct dentry *dentry) |
621 | { | 621 | { |
622 | struct debugfs_fsdata *fsd; | 622 | struct debugfs_fsdata *fsd; |
623 | 623 | ||
624 | simple_unlink(d_inode(parent), dentry); | ||
625 | d_delete(dentry); | ||
626 | |||
627 | /* | 624 | /* |
628 | * Paired with the closing smp_mb() implied by a successful | 625 | * Paired with the closing smp_mb() implied by a successful |
629 | * cmpxchg() in debugfs_file_get(): either | 626 | * cmpxchg() in debugfs_file_get(): either |
@@ -644,16 +641,15 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent) | |||
644 | 641 | ||
645 | if (simple_positive(dentry)) { | 642 | if (simple_positive(dentry)) { |
646 | dget(dentry); | 643 | dget(dentry); |
647 | if (!d_is_reg(dentry)) { | 644 | if (d_is_dir(dentry)) { |
648 | if (d_is_dir(dentry)) | 645 | ret = simple_rmdir(d_inode(parent), dentry); |
649 | ret = simple_rmdir(d_inode(parent), dentry); | ||
650 | else | ||
651 | simple_unlink(d_inode(parent), dentry); | ||
652 | if (!ret) | ||
653 | d_delete(dentry); | ||
654 | } else { | 646 | } else { |
655 | __debugfs_remove_file(dentry, parent); | 647 | simple_unlink(d_inode(parent), dentry); |
656 | } | 648 | } |
649 | if (!ret) | ||
650 | d_delete(dentry); | ||
651 | if (d_is_reg(dentry)) | ||
652 | __debugfs_file_removed(dentry); | ||
657 | dput(dentry); | 653 | dput(dentry); |
658 | } | 654 | } |
659 | return ret; | 655 | return ret; |