diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:22 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:50 -0400 |
commit | 74be0cc82835aecad332a29896b0f212ba893403 (patch) | |
tree | eaae59c73ba52ff8cab8ee845e989d9877603f4c /fs/notify/group.c | |
parent | cac69dad32899c6f4c66bb4f9baf69b0d3c7d3d1 (diff) |
fsnotify: remove group_num altogether
The original fsnotify interface has a group-num which was intended to be
able to find a group after it was added. I no longer think this is a
necessary thing to do and so we remove the group_num.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/group.c')
-rw-r--r-- | fs/notify/group.c | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/fs/notify/group.c b/fs/notify/group.c index 777ca8212255..62fb8961a57b 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -78,15 +78,6 @@ void fsnotify_recalc_group_mask(struct fsnotify_group *group) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * Take a reference to a group so things found under the fsnotify_grp_mutex | ||
82 | * can't get freed under us | ||
83 | */ | ||
84 | static void fsnotify_get_group(struct fsnotify_group *group) | ||
85 | { | ||
86 | atomic_inc(&group->refcnt); | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Final freeing of a group | 81 | * Final freeing of a group |
91 | */ | 82 | */ |
92 | void fsnotify_final_destroy_group(struct fsnotify_group *group) | 83 | void fsnotify_final_destroy_group(struct fsnotify_group *group) |
@@ -171,40 +162,14 @@ void fsnotify_put_group(struct fsnotify_group *group) | |||
171 | } | 162 | } |
172 | 163 | ||
173 | /* | 164 | /* |
174 | * Simply run the fsnotify_groups list and find a group which matches | ||
175 | * the given parameters. If a group is found we take a reference to that | ||
176 | * group. | ||
177 | */ | ||
178 | static struct fsnotify_group *fsnotify_find_group(unsigned int group_num, __u32 mask, | ||
179 | const struct fsnotify_ops *ops) | ||
180 | { | ||
181 | struct fsnotify_group *group_iter; | ||
182 | struct fsnotify_group *group = NULL; | ||
183 | |||
184 | BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex)); | ||
185 | |||
186 | list_for_each_entry_rcu(group_iter, &fsnotify_groups, group_list) { | ||
187 | if (group_iter->group_num == group_num) { | ||
188 | if ((group_iter->mask == mask) && | ||
189 | (group_iter->ops == ops)) { | ||
190 | fsnotify_get_group(group_iter); | ||
191 | group = group_iter; | ||
192 | } else | ||
193 | group = ERR_PTR(-EEXIST); | ||
194 | } | ||
195 | } | ||
196 | return group; | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * Either finds an existing group which matches the group_num, mask, and ops or | 165 | * Either finds an existing group which matches the group_num, mask, and ops or |
201 | * creates a new group and adds it to the global group list. In either case we | 166 | * creates a new group and adds it to the global group list. In either case we |
202 | * take a reference for the group returned. | 167 | * take a reference for the group returned. |
203 | */ | 168 | */ |
204 | struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, __u32 mask, | 169 | struct fsnotify_group *fsnotify_obtain_group(__u32 mask, |
205 | const struct fsnotify_ops *ops) | 170 | const struct fsnotify_ops *ops) |
206 | { | 171 | { |
207 | struct fsnotify_group *group, *tgroup; | 172 | struct fsnotify_group *group; |
208 | 173 | ||
209 | /* very low use, simpler locking if we just always alloc */ | 174 | /* very low use, simpler locking if we just always alloc */ |
210 | group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL); | 175 | group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL); |
@@ -214,7 +179,6 @@ struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, __u32 mask, | |||
214 | atomic_set(&group->refcnt, 1); | 179 | atomic_set(&group->refcnt, 1); |
215 | 180 | ||
216 | group->on_group_list = 0; | 181 | group->on_group_list = 0; |
217 | group->group_num = group_num; | ||
218 | group->mask = mask; | 182 | group->mask = mask; |
219 | 183 | ||
220 | mutex_init(&group->notification_mutex); | 184 | mutex_init(&group->notification_mutex); |
@@ -230,14 +194,6 @@ struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, __u32 mask, | |||
230 | group->ops = ops; | 194 | group->ops = ops; |
231 | 195 | ||
232 | mutex_lock(&fsnotify_grp_mutex); | 196 | mutex_lock(&fsnotify_grp_mutex); |
233 | tgroup = fsnotify_find_group(group_num, mask, ops); | ||
234 | if (tgroup) { | ||
235 | /* group already exists */ | ||
236 | mutex_unlock(&fsnotify_grp_mutex); | ||
237 | /* destroy the new one we made */ | ||
238 | fsnotify_put_group(group); | ||
239 | return tgroup; | ||
240 | } | ||
241 | 197 | ||
242 | /* group not found, add a new one */ | 198 | /* group not found, add a new one */ |
243 | list_add_rcu(&group->group_list, &fsnotify_groups); | 199 | list_add_rcu(&group->group_list, &fsnotify_groups); |