fsnotify: simplify arguments passing to fsnotify_parent()

Instead of passing both dentry and path and having to figure out which
one to use, pass data/data_type to simplify the code.

Link: https://lore.kernel.org/r/20200319151022.31456-6-amir73il@gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Amir Goldstein
2020-03-19 17:10:13 +02:00
committed by Jan Kara
parent aa93bdc550
commit 017de65fe5
3 changed files with 14 additions and 29 deletions

View File

@@ -38,16 +38,6 @@ static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry,
fsnotify_name(dir, mask, d_inode(dentry), &dentry->d_name, 0);
}
/* Notify this dentry's parent about a child's events. */
static inline int fsnotify_parent(const struct path *path,
struct dentry *dentry, __u32 mask)
{
if (!dentry)
dentry = path->dentry;
return __fsnotify_parent(path, dentry, mask);
}
/*
* Simple wrappers to consolidate calls fsnotify_parent()/fsnotify() when
* an event is on a file/dentry.
@@ -59,7 +49,7 @@ static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask)
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
fsnotify_parent(NULL, dentry, mask);
fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE);
fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
}
@@ -75,7 +65,7 @@ static inline int fsnotify_file(struct file *file, __u32 mask)
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
ret = fsnotify_parent(path, NULL, mask);
ret = fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH);
if (ret)
return ret;