Lines Matching refs:group
7 * Basic idea behind the notification queue: An fsnotify group (like inotify)
10 * event to the group notify queue. Since a single event might need to be on
11 * multiple group's notification queues we can't add the event directly to each
17 * another group a new event_holder (from fsnotify_event_holder_cachep) will be
51 bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group)
53 assert_spin_locked(&group->notification_lock);
54 return list_empty(&group->notification_list) ? true : false;
57 void fsnotify_destroy_event(struct fsnotify_group *group,
60 /* Overflow events are per-group and we don't want to free them */
61 if (!event || event == group->overflow_event)
70 spin_lock(&group->notification_lock);
72 spin_unlock(&group->notification_lock);
74 group->ops->free_event(event);
78 * Add an event to the group notification queue. The group can later pull this
82 * or the group is shutting down.
84 int fsnotify_add_event(struct fsnotify_group *group,
90 struct list_head *list = &group->notification_list;
92 pr_debug("%s: group=%p event=%p\n", __func__, group, event);
94 spin_lock(&group->notification_lock);
96 if (group->shutdown) {
97 spin_unlock(&group->notification_lock);
101 if (event == group->overflow_event ||
102 group->q_len >= group->max_events) {
105 if (!list_empty(&group->overflow_event->list)) {
106 spin_unlock(&group->notification_lock);
109 event = group->overflow_event;
116 spin_unlock(&group->notification_lock);
122 group->q_len++;
124 spin_unlock(&group->notification_lock);
126 wake_up(&group->notification_waitq);
127 kill_fasync(&group->fsn_fa, SIGIO, POLL_IN);
131 void fsnotify_remove_queued_event(struct fsnotify_group *group,
134 assert_spin_locked(&group->notification_lock);
140 group->q_len--;
147 struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
151 assert_spin_locked(&group->notification_lock);
153 pr_debug("%s: group=%p\n", __func__, group);
155 event = list_first_entry(&group->notification_list,
157 fsnotify_remove_queued_event(group, event);
165 struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
167 assert_spin_locked(&group->notification_lock);
169 return list_first_entry(&group->notification_list,
174 * Called when a group is being torn down to clean up any outstanding
177 void fsnotify_flush_notify(struct fsnotify_group *group)
181 spin_lock(&group->notification_lock);
182 while (!fsnotify_notify_queue_is_empty(group)) {
183 event = fsnotify_remove_first_event(group);
184 spin_unlock(&group->notification_lock);
185 fsnotify_destroy_event(group, event);
186 spin_lock(&group->notification_lock);
188 spin_unlock(&group->notification_lock);