Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 7e82879

Browse files
amir73ilvramyanaidu
authored andcommitted
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. Change-Id: I608735c5a1c9857c5b160cfd83ba3bd32a7670a3 Tracked-On: PKT-3186 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>
1 parent 669586f commit 7e82879

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

fs/debugfs/inode.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
620620
}
621621
EXPORT_SYMBOL_GPL(debugfs_create_symlink);
622622

623-
static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent)
623+
static void __debugfs_file_removed(struct dentry *dentry)
624624
{
625625
struct debugfs_fsdata *fsd;
626626

627-
simple_unlink(d_inode(parent), dentry);
628-
d_delete(dentry);
629-
630627
/*
631628
* Paired with the closing smp_mb() implied by a successful
632629
* cmpxchg() in debugfs_file_get(): either
@@ -647,16 +644,15 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
647644

648645
if (simple_positive(dentry)) {
649646
dget(dentry);
650-
if (!d_is_reg(dentry)) {
651-
if (d_is_dir(dentry))
652-
ret = simple_rmdir(d_inode(parent), dentry);
653-
else
654-
simple_unlink(d_inode(parent), dentry);
655-
if (!ret)
656-
d_delete(dentry);
647+
if (d_is_dir(dentry)) {
648+
ret = simple_rmdir(d_inode(parent), dentry);
657649
} else {
658-
__debugfs_remove_file(dentry, parent);
650+
simple_unlink(d_inode(parent), dentry);
659651
}
652+
if (!ret)
653+
d_delete(dentry);
654+
if (d_is_reg(dentry))
655+
__debugfs_file_removed(dentry);
660656
dput(dentry);
661657
}
662658
return ret;

0 commit comments

Comments
 (0)