On Thu 19-03-20 17:10:14, Amir Goldstein wrote: > Most events that can be reported to watching parent pass > FSNOTIFY_EVENT_PATH as event data, except for FS_ARRTIB and FS_MODIFY > as a result of truncate. > > Define a new data type to pass for event - FSNOTIFY_EVENT_DENTRY > and use it to pass the dentry instead of it's ->d_inode for those events. > > Soon, we are going to use the dentry data type to report events > with name info in fanotify backend. > > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> I've skipped this patch because FSNOTIFY_EVENT_DENTRY is not used by anything in this series... Just that you don't wonder when rebasing later. Honza > --- > include/linux/fsnotify.h | 4 ++-- > include/linux/fsnotify_backend.h | 17 +++++++++++++++++ > 2 files changed, 19 insertions(+), 2 deletions(-) > > diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h > index 860018f3e545..d286663fcef2 100644 > --- a/include/linux/fsnotify.h > +++ b/include/linux/fsnotify.h > @@ -49,8 +49,8 @@ static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask) > if (S_ISDIR(inode->i_mode)) > mask |= FS_ISDIR; > > - fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE); > - fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0); > + fsnotify_parent(dentry, mask, dentry, FSNOTIFY_EVENT_DENTRY); > + fsnotify(inode, mask, dentry, FSNOTIFY_EVENT_DENTRY, NULL, 0); > } > > static inline int fsnotify_file(struct file *file, __u32 mask) > diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h > index 337c87cf34d6..ab0913619403 100644 > --- a/include/linux/fsnotify_backend.h > +++ b/include/linux/fsnotify_backend.h > @@ -217,6 +217,7 @@ enum fsnotify_data_type { > FSNOTIFY_EVENT_NONE, > FSNOTIFY_EVENT_PATH, > FSNOTIFY_EVENT_INODE, > + FSNOTIFY_EVENT_DENTRY, > }; > > static inline const struct inode *fsnotify_data_inode(const void *data, > @@ -225,6 +226,8 @@ static inline const struct inode *fsnotify_data_inode(const void *data, > switch (data_type) { > case FSNOTIFY_EVENT_INODE: > return data; > + case FSNOTIFY_EVENT_DENTRY: > + return d_inode(data); > case FSNOTIFY_EVENT_PATH: > return d_inode(((const struct path *)data)->dentry); > default: > @@ -232,6 +235,20 @@ static inline const struct inode *fsnotify_data_inode(const void *data, > } > } > > +static inline struct dentry *fsnotify_data_dentry(const void *data, > + int data_type) > +{ > + switch (data_type) { > + case FSNOTIFY_EVENT_DENTRY: > + /* Non const is needed for dget() */ > + return (struct dentry *)data; > + case FSNOTIFY_EVENT_PATH: > + return ((const struct path *)data)->dentry; > + default: > + return NULL; > + } > +} > + > static inline const struct path *fsnotify_data_path(const void *data, > int data_type) > { > -- > 2.17.1 > -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR