@@ -77,15 +77,6 @@ void fsnotify_recalc_group_mask(struct fsnotify_group *group)
7777 fsnotify_recalc_global_mask ();
7878}
7979
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-
8980/*
9081 * Final freeing of a group
9182 */
@@ -170,41 +161,15 @@ void fsnotify_put_group(struct fsnotify_group *group)
170161 fsnotify_destroy_group (group );
171162}
172163
173- /*
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-
199164/*
200165 * Either finds an existing group which matches the group_num, mask, and ops or
201166 * creates a new group and adds it to the global group list. In either case we
202167 * take a reference for the group returned.
203168 */
204- struct fsnotify_group * fsnotify_obtain_group (unsigned int group_num , __u32 mask ,
169+ struct fsnotify_group * fsnotify_obtain_group (__u32 mask ,
205170 const struct fsnotify_ops * ops )
206171{
207- struct fsnotify_group * group , * tgroup ;
172+ struct fsnotify_group * group ;
208173
209174 /* very low use, simpler locking if we just always alloc */
210175 group = kzalloc (sizeof (struct fsnotify_group ), GFP_KERNEL );
@@ -214,7 +179,6 @@ struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, __u32 mask,
214179 atomic_set (& group -> refcnt , 1 );
215180
216181 group -> on_group_list = 0 ;
217- group -> group_num = group_num ;
218182 group -> mask = mask ;
219183
220184 mutex_init (& group -> notification_mutex );
@@ -230,14 +194,6 @@ struct fsnotify_group *fsnotify_obtain_group(unsigned int group_num, __u32 mask,
230194 group -> ops = ops ;
231195
232196 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- }
241197
242198 /* group not found, add a new one */
243199 list_add_rcu (& group -> group_list , & fsnotify_groups );
0 commit comments