Skip to content

Commit ffab834

Browse files
committed
fsnotify: fsnotify_obtain_group should be fsnotify_alloc_group
fsnotify_obtain_group was intended to be able to find an already existing group. Nothing uses that functionality. This just renames it to fsnotify_alloc_group so it is clear what it is doing. Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent cd7752c commit ffab834

6 files changed

Lines changed: 10 additions & 14 deletions

File tree

‎fs/notify/dnotify/dnotify.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ static int __init dnotify_init(void)
433433
dnotify_struct_cache = KMEM_CACHE(dnotify_struct, SLAB_PANIC);
434434
dnotify_mark_entry_cache = KMEM_CACHE(dnotify_mark_entry, SLAB_PANIC);
435435

436-
dnotify_group = fsnotify_obtain_group(0, &dnotify_fsnotify_ops);
436+
dnotify_group = fsnotify_alloc_group(0, &dnotify_fsnotify_ops);
437437
if (IS_ERR(dnotify_group))
438438
panic("unable to allocate fsnotify group for dnotify\n");
439439
return 0;

‎fs/notify/group.c‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,13 @@ void fsnotify_put_group(struct fsnotify_group *group)
162162
}
163163

164164
/*
165-
* Either finds an existing group which matches the group_num, mask, and ops or
166-
* creates a new group and adds it to the global group list. In either case we
167-
* take a reference for the group returned.
165+
* Create a new fsnotify_group and hold a reference for the group returned.
168166
*/
169-
struct fsnotify_group *fsnotify_obtain_group(__u32 mask,
170-
const struct fsnotify_ops *ops)
167+
struct fsnotify_group *fsnotify_alloc_group(__u32 mask,
168+
const struct fsnotify_ops *ops)
171169
{
172170
struct fsnotify_group *group;
173171

174-
/* very low use, simpler locking if we just always alloc */
175172
group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL);
176173
if (!group)
177174
return ERR_PTR(-ENOMEM);
@@ -192,7 +189,6 @@ struct fsnotify_group *fsnotify_obtain_group(__u32 mask,
192189

193190
mutex_lock(&fsnotify_grp_mutex);
194191

195-
/* group not found, add a new one */
196192
list_add_rcu(&group->group_list, &fsnotify_groups);
197193
group->on_group_list = 1;
198194
/* being on the fsnotify_groups list holds one num_marks */

‎fs/notify/inotify/inotify_user.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign
695695
{
696696
struct fsnotify_group *group;
697697

698-
group = fsnotify_obtain_group(0, &inotify_fsnotify_ops);
698+
group = fsnotify_alloc_group(0, &inotify_fsnotify_ops);
699699
if (IS_ERR(group))
700700
return group;
701701

‎include/linux/fsnotify_backend.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
305305
/* must call when a group changes its ->mask */
306306
extern void fsnotify_recalc_global_mask(void);
307307
/* get a reference to an existing or create a new group */
308-
extern struct fsnotify_group *fsnotify_obtain_group(__u32 mask,
308+
extern struct fsnotify_group *fsnotify_alloc_group(__u32 mask,
309309
const struct fsnotify_ops *ops);
310310
/* run all marks associated with this group and update group->mask */
311311
extern void fsnotify_recalc_group_mask(struct fsnotify_group *group);
312-
/* drop reference on a group from fsnotify_obtain_group */
312+
/* drop reference on a group from fsnotify_alloc_group */
313313
extern void fsnotify_put_group(struct fsnotify_group *group);
314314

315315
/* take a reference to an event */

‎kernel/audit_tree.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ static int __init audit_tree_init(void)
937937
{
938938
int i;
939939

940-
audit_tree_group = fsnotify_obtain_group(0, &audit_tree_ops);
940+
audit_tree_group = fsnotify_alloc_group(0, &audit_tree_ops);
941941
if (IS_ERR(audit_tree_group))
942942
audit_panic("cannot initialize fsnotify group for rectree watches");
943943

‎kernel/audit_watch.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,8 @@ static const struct fsnotify_ops audit_watch_fsnotify_ops = {
577577

578578
static int __init audit_watch_init(void)
579579
{
580-
audit_watch_group = fsnotify_obtain_group(AUDIT_FS_WATCH,
581-
&audit_watch_fsnotify_ops);
580+
audit_watch_group = fsnotify_alloc_group(AUDIT_FS_WATCH,
581+
&audit_watch_fsnotify_ops);
582582
if (IS_ERR(audit_watch_group)) {
583583
audit_watch_group = NULL;
584584
audit_panic("cannot create audit fsnotify group");

0 commit comments

Comments
 (0)