We can get inode by dereferenceing dentry->d_inode, but that may have performance impact in the fast path of non watched file. Kernel test robot reported a performance regression in concurrent open workload, so maybe that can fix it. Reported-by: kernel test robot <rong.a.chen@xxxxxxxxx> Fixes: c738fbabb0ff ("fsnotify: fold fsnotify() call into fsnotify_parent()") Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> --- include/linux/fsnotify.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index d9b26c6552ee..4a9b2f5b819b 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h @@ -49,10 +49,9 @@ static inline void fsnotify_inode(struct inode *inode, __u32 mask) /* Notify this dentry's parent about a child's events. */ static inline int fsnotify_parent(struct dentry *dentry, __u32 mask, - const void *data, int data_type) + const void *data, int data_type, + struct inode *inode) { - struct inode *inode = d_inode(dentry); - if (S_ISDIR(inode->i_mode)) { mask |= FS_ISDIR; @@ -77,7 +76,8 @@ static inline int fsnotify_parent(struct dentry *dentry, __u32 mask, */ static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask) { - fsnotify_parent(dentry, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE); + fsnotify_parent(dentry, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, + d_inode(dentry)); } static inline int fsnotify_file(struct file *file, __u32 mask) @@ -87,7 +87,8 @@ static inline int fsnotify_file(struct file *file, __u32 mask) if (file->f_mode & FMODE_NONOTIFY) return 0; - return fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH); + return fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH, + file_inode(file)); } /* Simple call site for access decisions */ -- 2.17.1