"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.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -59,27 +59,33 @@ · 58 unmodified lines | |||
| 59 | * dnotify and inotify. */ | 59 | * dnotify and inotify. */ |
| 60 | #define FS_EVENT_ON_CHILD 0x08000000 | 60 | #define FS_EVENT_ON_CHILD 0x08000000 |
| 61 | 61 | ||
| 62 | /* This is a list of all events that may get sent to a parernt based on fs event | ||
| 63 | * happening to inodes inside that directory */ | ||
| 64 | #define FS_EVENTS_POSS_ON_CHILD (FS_ACCESS | FS_MODIFY | FS_ATTRIB |\ | ||
| 65 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN |\ | ||
| 66 | FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE |\ | ||
| 67 | FS_DELETE | FS_OPEN_PERM | FS_ACCESS_PERM | \ | ||
| 68 | FS_OPEN_EXEC | FS_OPEN_EXEC_PERM) | ||
| 69 | |||
| 70 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) | 62 | #define FS_MOVE (FS_MOVED_FROM | FS_MOVED_TO) |
| 71 | 63 | ||
| 64 | /* | ||
| 65 | * Directory entry modification events - reported only to directory | ||
| 66 | * where entry is modified and not to a watching parent. | ||
| 67 | * The watching parent may get an FS_ATTRIB|FS_EVENT_ON_CHILD event | ||
| 68 | * when a directory entry inside a child subdir changes. | ||
| 69 | */ | ||
| 70 | #define ALL_FSNOTIFY_DIRENT_EVENTS (FS_CREATE | FS_DELETE | FS_MOVE) | ||
| 71 | |||
| 72 | #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \ | 72 | #define ALL_FSNOTIFY_PERM_EVENTS (FS_OPEN_PERM | FS_ACCESS_PERM | \ |
| 73 | FS_OPEN_EXEC_PERM) | 73 | FS_OPEN_EXEC_PERM) |
| 74 | 74 | ||
| 75 | /* | ||
| 76 | * This is a list of all events that may get sent to a parent based on fs event | ||
| 77 | * happening to inodes inside that directory. | ||
| 78 | */ | ||
| 79 | #define FS_EVENTS_POSS_ON_CHILD (ALL_FSNOTIFY_PERM_EVENTS | \ | ||
| 80 | FS_ACCESS | FS_MODIFY | FS_ATTRIB | \ | ||
| 81 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | \ | ||
| 82 | FS_OPEN | FS_OPEN_EXEC) | ||
| 83 | |||
| 75 | /* Events that can be reported to backends */ | 84 | /* Events that can be reported to backends */ |
| 76 | #define ALL_FSNOTIFY_EVENTS (FS_ACCESS | FS_MODIFY | FS_ATTRIB | \ | 85 | #define ALL_FSNOTIFY_EVENTS (ALL_FSNOTIFY_DIRENT_EVENTS | \ |
| 77 | FS_CLOSE_WRITE | FS_CLOSE_NOWRITE | FS_OPEN | \ | 86 | FS_EVENTS_POSS_ON_CHILD | \ |
| 78 | FS_MOVED_FROM | FS_MOVED_TO | FS_CREATE | \ | 87 | FS_DELETE_SELF | FS_MOVE_SELF | FS_DN_RENAME | \ |
| 79 | FS_DELETE | FS_DELETE_SELF | FS_MOVE_SELF | \ | 88 | FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED) |
| 80 | FS_UNMOUNT | FS_Q_OVERFLOW | FS_IN_IGNORED | \ | ||
| 81 | FS_OPEN_PERM | FS_ACCESS_PERM | FS_DN_RENAME | \ | ||
| 82 | FS_OPEN_EXEC | FS_OPEN_EXEC_PERM) | ||
| 83 | 89 | ||
| 84 | /* Extra flags that may be reported with event or control handling of events */ | 90 | /* Extra flags that may be reported with event or control handling of events */ |
| 85 | #define ALL_FSNOTIFY_FLAGS (FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \ | 91 | #define ALL_FSNOTIFY_FLAGS (FS_EXCL_UNLINK | FS_ISDIR | FS_IN_ONESHOT | \ |