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 | ffab83402f01555a5fa32efb48a4dd0ce8d12ef5 (patch) | |
tree | 4e02fa7422becb56e6ed4b8721f8b0fb3a867d44 | |
parent | cd7752ce7cac5184ca35aecebffafae9662570bc (diff) |
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>
-rw-r--r-- | fs/notify/dnotify/dnotify.c | 2 | ||||
-rw-r--r-- | fs/notify/group.c | 10 | ||||
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 2 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 4 | ||||
-rw-r--r-- | kernel/audit_tree.c | 2 | ||||
-rw-r--r-- | kernel/audit_watch.c | 4 |
6 files changed, 10 insertions, 14 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 1f46aeac3387..51e4fe33d6bb 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -433,7 +433,7 @@ static int __init dnotify_init(void) | |||
433 | dnotify_struct_cache = KMEM_CACHE(dnotify_struct, SLAB_PANIC); | 433 | dnotify_struct_cache = KMEM_CACHE(dnotify_struct, SLAB_PANIC); |
434 | dnotify_mark_entry_cache = KMEM_CACHE(dnotify_mark_entry, SLAB_PANIC); | 434 | dnotify_mark_entry_cache = KMEM_CACHE(dnotify_mark_entry, SLAB_PANIC); |
435 | 435 | ||
436 | dnotify_group = fsnotify_obtain_group(0, &dnotify_fsnotify_ops); | 436 | dnotify_group = fsnotify_alloc_group(0, &dnotify_fsnotify_ops); |
437 | if (IS_ERR(dnotify_group)) | 437 | if (IS_ERR(dnotify_group)) |
438 | panic("unable to allocate fsnotify group for dnotify\n"); | 438 | panic("unable to allocate fsnotify group for dnotify\n"); |
439 | return 0; | 439 | return 0; |
diff --git a/fs/notify/group.c b/fs/notify/group.c index 934860e98095..1d20d26d5fee 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -162,16 +162,13 @@ void fsnotify_put_group(struct fsnotify_group *group) | |||
162 | } | 162 | } |
163 | 163 | ||
164 | /* | 164 | /* |
165 | * Either finds an existing group which matches the group_num, mask, and ops or | 165 | * Create a new fsnotify_group and hold a reference for the group returned. |
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. | ||
168 | */ | 166 | */ |
169 | struct fsnotify_group *fsnotify_obtain_group(__u32 mask, | 167 | struct fsnotify_group *fsnotify_alloc_group(__u32 mask, |
170 | const struct fsnotify_ops *ops) | 168 | const struct fsnotify_ops *ops) |
171 | { | 169 | { |
172 | struct fsnotify_group *group; | 170 | struct fsnotify_group *group; |
173 | 171 | ||
174 | /* very low use, simpler locking if we just always alloc */ | ||
175 | group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL); | 172 | group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL); |
176 | if (!group) | 173 | if (!group) |
177 | return ERR_PTR(-ENOMEM); | 174 | return ERR_PTR(-ENOMEM); |
@@ -192,7 +189,6 @@ struct fsnotify_group *fsnotify_obtain_group(__u32 mask, | |||
192 | 189 | ||
193 | mutex_lock(&fsnotify_grp_mutex); | 190 | mutex_lock(&fsnotify_grp_mutex); |
194 | 191 | ||
195 | /* group not found, add a new one */ | ||
196 | list_add_rcu(&group->group_list, &fsnotify_groups); | 192 | list_add_rcu(&group->group_list, &fsnotify_groups); |
197 | group->on_group_list = 1; | 193 | group->on_group_list = 1; |
198 | /* being on the fsnotify_groups list holds one num_marks */ | 194 | /* being on the fsnotify_groups list holds one num_marks */ |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index cae317f5bd9d..25a2854186e9 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -695,7 +695,7 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign | |||
695 | { | 695 | { |
696 | struct fsnotify_group *group; | 696 | struct fsnotify_group *group; |
697 | 697 | ||
698 | group = fsnotify_obtain_group(0, &inotify_fsnotify_ops); | 698 | group = fsnotify_alloc_group(0, &inotify_fsnotify_ops); |
699 | if (IS_ERR(group)) | 699 | if (IS_ERR(group)) |
700 | return group; | 700 | return group; |
701 | 701 | ||
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 57e503d017c8..7d3c03e46862 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -305,11 +305,11 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode | |||
305 | /* must call when a group changes its ->mask */ | 305 | /* must call when a group changes its ->mask */ |
306 | extern void fsnotify_recalc_global_mask(void); | 306 | extern void fsnotify_recalc_global_mask(void); |
307 | /* get a reference to an existing or create a new group */ | 307 | /* 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, |
309 | const struct fsnotify_ops *ops); | 309 | const struct fsnotify_ops *ops); |
310 | /* run all marks associated with this group and update group->mask */ | 310 | /* run all marks associated with this group and update group->mask */ |
311 | extern void fsnotify_recalc_group_mask(struct fsnotify_group *group); | 311 | 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 */ |
313 | extern void fsnotify_put_group(struct fsnotify_group *group); | 313 | extern void fsnotify_put_group(struct fsnotify_group *group); |
314 | 314 | ||
315 | /* take a reference to an event */ | 315 | /* take a reference to an event */ |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 59065e72a2eb..813274d4edad 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -937,7 +937,7 @@ static int __init audit_tree_init(void) | |||
937 | { | 937 | { |
938 | int i; | 938 | int i; |
939 | 939 | ||
940 | audit_tree_group = fsnotify_obtain_group(0, &audit_tree_ops); | 940 | audit_tree_group = fsnotify_alloc_group(0, &audit_tree_ops); |
941 | if (IS_ERR(audit_tree_group)) | 941 | if (IS_ERR(audit_tree_group)) |
942 | audit_panic("cannot initialize fsnotify group for rectree watches"); | 942 | audit_panic("cannot initialize fsnotify group for rectree watches"); |
943 | 943 | ||
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index c500104d38c2..0f03a6ab96ed 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -577,8 +577,8 @@ static const struct fsnotify_ops audit_watch_fsnotify_ops = { | |||
577 | 577 | ||
578 | static int __init audit_watch_init(void) | 578 | static int __init audit_watch_init(void) |
579 | { | 579 | { |
580 | audit_watch_group = fsnotify_obtain_group(AUDIT_FS_WATCH, | 580 | audit_watch_group = fsnotify_alloc_group(AUDIT_FS_WATCH, |
581 | &audit_watch_fsnotify_ops); | 581 | &audit_watch_fsnotify_ops); |
582 | if (IS_ERR(audit_watch_group)) { | 582 | if (IS_ERR(audit_watch_group)) { |
583 | audit_watch_group = NULL; | 583 | audit_watch_group = NULL; |
584 | audit_panic("cannot create audit fsnotify group"); | 584 | audit_panic("cannot create audit fsnotify group"); |