Lines Matching refs:group
20 * Final freeing of a group
22 static void fsnotify_final_destroy_group(struct fsnotify_group *group)
24 if (group->ops->free_group_priv)
25 group->ops->free_group_priv(group);
27 mem_cgroup_put(group->memcg);
28 mutex_destroy(&group->mark_mutex);
30 kfree(group);
34 * Stop queueing new events for this group. Once this function returns
35 * fsnotify_add_event() will not add any new events to the group's queue.
37 void fsnotify_group_stop_queueing(struct fsnotify_group *group)
39 spin_lock(&group->notification_lock);
40 group->shutdown = true;
41 spin_unlock(&group->notification_lock);
45 * Trying to get rid of a group. Remove all marks, flush all events and release
46 * the group reference.
48 * hold a ref to the group.
50 void fsnotify_destroy_group(struct fsnotify_group *group)
58 fsnotify_group_stop_queueing(group);
60 /* Clear all marks for this group and queue them for destruction */
61 fsnotify_clear_marks_by_group(group, FSNOTIFY_OBJ_ALL_TYPES_MASK);
68 wait_event(group->notification_waitq, !atomic_read(&group->user_waits));
81 * notification against this group. So clearing the notification queue
84 fsnotify_flush_notify(group);
90 if (group->overflow_event)
91 group->ops->free_event(group->overflow_event);
93 fsnotify_put_group(group);
97 * Get reference to a group.
99 void fsnotify_get_group(struct fsnotify_group *group)
101 refcount_inc(&group->refcnt);
105 * Drop a reference to a group. Free it if it's through.
107 void fsnotify_put_group(struct fsnotify_group *group)
109 if (refcount_dec_and_test(&group->refcnt))
110 fsnotify_final_destroy_group(group);
115 * Create a new fsnotify_group and hold a reference for the group returned.
119 struct fsnotify_group *group;
121 group = kzalloc(sizeof(struct fsnotify_group), GFP_KERNEL);
122 if (!group)
125 /* set to 0 when there a no external references to this group */
126 refcount_set(&group->refcnt, 1);
127 atomic_set(&group->num_marks, 0);
128 atomic_set(&group->user_waits, 0);
130 spin_lock_init(&group->notification_lock);
131 INIT_LIST_HEAD(&group->notification_list);
132 init_waitqueue_head(&group->notification_waitq);
133 group->max_events = UINT_MAX;
135 mutex_init(&group->mark_mutex);
136 INIT_LIST_HEAD(&group->marks_list);
138 group->ops = ops;
140 return group;
146 struct fsnotify_group *group = file->private_data;
148 return fasync_helper(fd, file, on, &group->fsn_fa) >= 0 ? 0 : -EIO;