fsnotify: merge file_set_fsnotify_mode_from_watchers() with open perm hook

Create helper fsnotify_open_perm_and_set_mode() that moves the
fsnotify_open_perm() hook into file_set_fsnotify_mode_from_watchers().

This will allow some more optimizations.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20250708143641.418603-2-amir73il@gmail.com
This commit is contained in:
Amir Goldstein
2025-07-08 16:36:40 +02:00
committed by Jan Kara
parent 3193e8942f
commit 08da98e1b2
4 changed files with 20 additions and 18 deletions

View File

@@ -196,7 +196,7 @@ static int init_file(struct file *f, int flags, const struct cred *cred)
file_ref_init(&f->f_ref, 1);
/*
* Disable permission and pre-content events for all files by default.
* They may be enabled later by file_set_fsnotify_mode_from_watchers().
* They may be enabled later by fsnotify_open_perm_and_set_mode().
*/
file_set_fsnotify_mode(f, FMODE_NONOTIFY_PERM);
return 0;