fsnotify: remove dirent events from FS_EVENTS_POSS_ON_CHILD mask
authorAmir Goldstein <amir73il@gmail.com>
Thu, 10 Jan 2019 17:04:29 +0000 (19:04 +0200)
committerJan Kara <jack@suse.cz>
Wed, 6 Feb 2019 14:18:06 +0000 (15:18 +0100)
commite220140ff6241e180d0c2fc294e61ee6bbc6a18e
treeb630e72b298be61e3c99ab932dc914268ceae431
parent5f02a877638472e83cb5e335f9eec27052b1c7c2
fsnotify: remove dirent events from FS_EVENTS_POSS_ON_CHILD mask

"dirent" events are referring to events that modify directory entries,
such as create,delete,rename. Those events are always be reported
on a watched directory, regardless if FS_EVENT_ON_CHILD is set
on the watch mask.

ALL_FSNOTIFY_DIRENT_EVENTS defines all the dirent event types and
those event types are removed from FS_EVENTS_POSS_ON_CHILD.

That means for a directory with an inotify watch and only dirent
events in the mask (i.e. create,delete,move), all children dentries
will no longer have the DCACHE_FSNOTIFY_PARENT_WATCHED flag set.
This will allow all events that happen on children to be optimized
away in __fsnotify_parent() without the need to dereference
child->d_parent->d_inode->i_fsnotify_mask.

Since the dirent events are never repoted via __fsnotify_parent(),
this results in no change of logic, but only an optimization.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
include/linux/fsnotify_backend.h