diff options
author | Amir Goldstein <amir73il@gmail.com> | 2025-07-08 16:36:41 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2025-07-28 18:14:38 +0200 |
commit | 0d4c4d4ea443babab6ec1a79f481260963fc969a (patch) | |
tree | 219a7d83e993f6b00148d530587d5227fffda642 /rust/helpers/cpu.c | |
parent | 08da98e1b2f76cdbacf84b9affaa75960dbce515 (diff) |
fsnotify: optimize FMODE_NONOTIFY_PERM for the common cases
The most unlikely watched permission event is FAN_ACCESS_PERM, because
at the time that it was introduced there were no evictable ignore mark,
so subscribing to FAN_ACCESS_PERM would have incured a very high
overhead.
Yet, when we set the fmode to FMODE_NOTIFY_HSM(), we never skip trying
to send FAN_ACCESS_PERM, which is almost always a waste of cycles.
We got to this logic because of bundling FAN_OPEN*_PERM and
FAN_ACCESS_PERM in the same category and because FAN_OPEN_PERM is a
commonly used event.
By open coding fsnotify_open_perm() in fsnotify_open_perm_and_set_mode(),
we no longer need to regard FAN_OPEN*_PERM when calculating fmode.
This leaves the case of having pre-content events and not having any
other permission event in the object masks a more likely case than the
other way around.
Rework the fmode macros and code so that their meaning now refers only
to hooks on an already open file:
- FMODE_NOTIFY_NONE() skip all events
- FMODE_NOTIFY_ACCESS_PERM() send all permission events including
FAN_ACCESS_PERM
- FMODE_NOTIFY_HSM() send pre-content permission events
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250708143641.418603-3-amir73il@gmail.com
Diffstat (limited to 'rust/helpers/cpu.c')
0 files changed, 0 insertions, 0 deletions