summaryrefslogtreecommitdiffstats
path: root/fs/notify/fsnotify.h
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2024-03-17 19:41:51 +0100
committerJan Kara <jack@suse.cz>2024-04-04 16:24:16 +0200
commit07a3b8d0bf726a1e49b050bbc6bd72f031e505fe (patch)
tree45d9153d780282b0d4f2999811a9d210b63e1d62 /fs/notify/fsnotify.h
parentfsnotify: create helper fsnotify_update_sb_watchers() (diff)
downloadlinux-07a3b8d0bf726a1e49b050bbc6bd72f031e505fe.tar.xz
linux-07a3b8d0bf726a1e49b050bbc6bd72f031e505fe.zip
fsnotify: lazy attach fsnotify_sb_info state to sb
Define a container struct fsnotify_sb_info to hold per-sb state, including the reference to sb marks connector. Allocate the fsnotify_sb_info state before attaching connector to any object on the sb and free it only when killing sb. This state is going to be used for storing per priority watched objects counters. Suggested-by: Jan Kara <jack@suse.cz> Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20240317184154.1200192-8-amir73il@gmail.com>
Diffstat (limited to 'fs/notify/fsnotify.h')
-rw-r--r--fs/notify/fsnotify.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h
index b1fec7cd8ee4..2d059f789ee3 100644
--- a/fs/notify/fsnotify.h
+++ b/fs/notify/fsnotify.h
@@ -54,6 +54,13 @@ static inline struct super_block *fsnotify_connector_sb(
return fsnotify_object_sb(conn->obj, conn->type);
}
+static inline fsnotify_connp_t *fsnotify_sb_marks(struct super_block *sb)
+{
+ struct fsnotify_sb_info *sbinfo = fsnotify_sb_info(sb);
+
+ return sbinfo ? &sbinfo->sb_marks : NULL;
+}
+
/* destroy all events sitting in this groups notification queue */
extern void fsnotify_flush_notify(struct fsnotify_group *group);
@@ -79,7 +86,7 @@ static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
/* run the list of all marks associated with sb and destroy them */
static inline void fsnotify_clear_marks_by_sb(struct super_block *sb)
{
- fsnotify_destroy_marks(&sb->s_fsnotify_marks);
+ fsnotify_destroy_marks(fsnotify_sb_marks(sb));
}
/*