aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/group.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 10:18:39 -0400
committerEric Paris <eparis@redhat.com>2010-07-28 10:18:54 -0400
commit03930979afa63e079e9aefd4d3dd429240711027 (patch)
tree7df0097a8d51b9f71b4f10a0f49e773fb41d9ba5 /fs/notify/group.c
parent2612abb51b11ffd2d75c472b11178115f5808909 (diff)
fsnotify: remove the global masks
Because we walk the object->fsnotify_marks list instead of the global fsnotify groups list we don't need the fsnotify_inode_mask and fsnotify_vfsmount_mask as these were simply shortcuts in fsnotify() for performance. They are now extra checks, rip them out. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/group.c')
-rw-r--r--fs/notify/group.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/fs/notify/group.c b/fs/notify/group.c
index 48d3a6d6e47a..8da532dd6026 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -34,54 +34,21 @@ static DEFINE_MUTEX(fsnotify_grp_mutex);
34LIST_HEAD(fsnotify_inode_groups); 34LIST_HEAD(fsnotify_inode_groups);
35/* all groups registered to receive mount point filesystem notifications */ 35/* all groups registered to receive mount point filesystem notifications */
36LIST_HEAD(fsnotify_vfsmount_groups); 36LIST_HEAD(fsnotify_vfsmount_groups);
37/* bitwise OR of all events (FS_*) interesting to some group on this system */
38__u32 fsnotify_inode_mask;
39/* bitwise OR of all events (FS_*) interesting to some group on this system */
40__u32 fsnotify_vfsmount_mask;
41
42/*
43 * When a new group registers or changes it's set of interesting events
44 * this function updates the fsnotify_mask to contain all interesting events
45 */
46void fsnotify_recalc_global_mask(void)
47{
48 struct fsnotify_group *group;
49 __u32 inode_mask = 0;
50 __u32 vfsmount_mask = 0;
51
52 mutex_lock(&fsnotify_grp_mutex);
53 list_for_each_entry_rcu(group, &fsnotify_inode_groups, inode_group_list)
54 inode_mask |= group->mask;
55 list_for_each_entry_rcu(group, &fsnotify_vfsmount_groups, vfsmount_group_list)
56 vfsmount_mask |= group->mask;
57
58 fsnotify_inode_mask = inode_mask;
59 fsnotify_vfsmount_mask = vfsmount_mask;
60
61 mutex_unlock(&fsnotify_grp_mutex);
62}
63 37
64/* 38/*
65 * Update the group->mask by running all of the marks associated with this 39 * Update the group->mask by running all of the marks associated with this
66 * group and finding the bitwise | of all of the mark->mask. If we change 40 * group and finding the bitwise | of all of the mark->mask.
67 * the group->mask we need to update the global mask of events interesting
68 * to the system.
69 */ 41 */
70void fsnotify_recalc_group_mask(struct fsnotify_group *group) 42void fsnotify_recalc_group_mask(struct fsnotify_group *group)
71{ 43{
72 __u32 mask = 0; 44 __u32 mask = 0;
73 __u32 old_mask = group->mask;
74 struct fsnotify_mark *mark; 45 struct fsnotify_mark *mark;
75 46
76 spin_lock(&group->mark_lock); 47 spin_lock(&group->mark_lock);
77 list_for_each_entry(mark, &group->marks_list, g_list) 48 list_for_each_entry(mark, &group->marks_list, g_list)
78 mask |= mark->mask; 49 mask |= mark->mask;
79 spin_unlock(&group->mark_lock);
80
81 group->mask = mask; 50 group->mask = mask;
82 51 spin_unlock(&group->mark_lock);
83 if (old_mask != mask)
84 fsnotify_recalc_global_mask();
85} 52}
86 53
87void fsnotify_add_vfsmount_group(struct fsnotify_group *group) 54void fsnotify_add_vfsmount_group(struct fsnotify_group *group)
@@ -217,8 +184,6 @@ void fsnotify_put_group(struct fsnotify_group *group)
217 184
218 mutex_unlock(&fsnotify_grp_mutex); 185 mutex_unlock(&fsnotify_grp_mutex);
219 186
220 /* and now it is really dead. _Nothing_ could be seeing it */
221 fsnotify_recalc_global_mask();
222 fsnotify_destroy_group(group); 187 fsnotify_destroy_group(group);
223} 188}
224 189