aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/group.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-17 21:24:23 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:51 -0400
commit19c2a0e1a2f60112c158342ba5f568f72b741c2c (patch)
tree807520e66657e25420389c376cccaf5ca283f346 /fs/notify/group.c
parent0d2e2a1d00d7d23e5bd9bb0935cde7c3d5835c56 (diff)
fsnotify: rename fsnotify_groups to fsnotify_inode_groups
Simple renaming patch. fsnotify is about to support mount point listeners so I am renaming fsnotify_groups and fsnotify_mask to indicate these are lists used only for groups which have watches on inodes. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/group.c')
-rw-r--r--fs/notify/group.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/fs/notify/group.c b/fs/notify/group.c
index 1657349c30a6..c80809745312 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -33,9 +33,9 @@ static DEFINE_MUTEX(fsnotify_grp_mutex);
33/* protects reads while running the fsnotify_groups list */ 33/* protects reads while running the fsnotify_groups list */
34struct srcu_struct fsnotify_grp_srcu; 34struct srcu_struct fsnotify_grp_srcu;
35/* all groups registered to receive filesystem notifications */ 35/* all groups registered to receive filesystem notifications */
36LIST_HEAD(fsnotify_groups); 36LIST_HEAD(fsnotify_inode_groups);
37/* bitwise OR of all events (FS_*) interesting to some group on this system */ 37/* bitwise OR of all events (FS_*) interesting to some group on this system */
38__u32 fsnotify_mask; 38__u32 fsnotify_inode_mask;
39 39
40/* 40/*
41 * When a new group registers or changes it's set of interesting events 41 * When a new group registers or changes it's set of interesting events
@@ -48,10 +48,10 @@ void fsnotify_recalc_global_mask(void)
48 int idx; 48 int idx;
49 49
50 idx = srcu_read_lock(&fsnotify_grp_srcu); 50 idx = srcu_read_lock(&fsnotify_grp_srcu);
51 list_for_each_entry_rcu(group, &fsnotify_groups, group_list) 51 list_for_each_entry_rcu(group, &fsnotify_inode_groups, inode_group_list)
52 mask |= group->mask; 52 mask |= group->mask;
53 srcu_read_unlock(&fsnotify_grp_srcu, idx); 53 srcu_read_unlock(&fsnotify_grp_srcu, idx);
54 fsnotify_mask = mask; 54 fsnotify_inode_mask = mask;
55} 55}
56 56
57/* 57/*
@@ -77,6 +77,17 @@ void fsnotify_recalc_group_mask(struct fsnotify_group *group)
77 fsnotify_recalc_global_mask(); 77 fsnotify_recalc_global_mask();
78} 78}
79 79
80static void fsnotify_add_group(struct fsnotify_group *group)
81{
82 BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex));
83
84 group->on_inode_group_list = 1;
85 /* being on the fsnotify_groups list holds one num_marks */
86 atomic_inc(&group->num_marks);
87
88 list_add_tail_rcu(&group->inode_group_list, &fsnotify_inode_groups);
89}
90
80/* 91/*
81 * Final freeing of a group 92 * Final freeing of a group
82 */ 93 */
@@ -118,9 +129,9 @@ static void __fsnotify_evict_group(struct fsnotify_group *group)
118{ 129{
119 BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex)); 130 BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex));
120 131
121 if (group->on_group_list) 132 if (group->on_inode_group_list)
122 list_del_rcu(&group->group_list); 133 list_del_rcu(&group->inode_group_list);
123 group->on_group_list = 0; 134 group->on_inode_group_list = 0;
124} 135}
125 136
126/* 137/*
@@ -186,10 +197,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
186 197
187 mutex_lock(&fsnotify_grp_mutex); 198 mutex_lock(&fsnotify_grp_mutex);
188 199
189 list_add_rcu(&group->group_list, &fsnotify_groups); 200 fsnotify_add_group(group);
190 group->on_group_list = 1;
191 /* being on the fsnotify_groups list holds one num_marks */
192 atomic_inc(&group->num_marks);
193 201
194 mutex_unlock(&fsnotify_grp_mutex); 202 mutex_unlock(&fsnotify_grp_mutex);
195 203