Lines Matching full: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) in fsnotify_notify_queue_is_empty() argument
53 assert_spin_locked(&group->notification_lock); in fsnotify_notify_queue_is_empty()
54 return list_empty(&group->notification_list) ? true : false; in fsnotify_notify_queue_is_empty()
57 void fsnotify_destroy_event(struct fsnotify_group *group, in fsnotify_destroy_event() argument
60 /* Overflow events are per-group and we don't want to free them */ in fsnotify_destroy_event()
61 if (!event || event == group->overflow_event) in fsnotify_destroy_event()
70 spin_lock(&group->notification_lock); in fsnotify_destroy_event()
72 spin_unlock(&group->notification_lock); in fsnotify_destroy_event()
74 group->ops->free_event(event); in fsnotify_destroy_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, in fsnotify_add_event() argument
90 struct list_head *list = &group->notification_list; in fsnotify_add_event()
92 pr_debug("%s: group=%p event=%p\n", __func__, group, event); in fsnotify_add_event()
94 spin_lock(&group->notification_lock); in fsnotify_add_event()
96 if (group->shutdown) { in fsnotify_add_event()
97 spin_unlock(&group->notification_lock); in fsnotify_add_event()
101 if (event == group->overflow_event || in fsnotify_add_event()
102 group->q_len >= group->max_events) { in fsnotify_add_event()
105 if (!list_empty(&group->overflow_event->list)) { in fsnotify_add_event()
106 spin_unlock(&group->notification_lock); in fsnotify_add_event()
109 event = group->overflow_event; in fsnotify_add_event()
116 spin_unlock(&group->notification_lock); in fsnotify_add_event()
122 group->q_len++; in fsnotify_add_event()
124 spin_unlock(&group->notification_lock); in fsnotify_add_event()
126 wake_up(&group->notification_waitq); in fsnotify_add_event()
127 kill_fasync(&group->fsn_fa, SIGIO, POLL_IN); in fsnotify_add_event()
131 void fsnotify_remove_queued_event(struct fsnotify_group *group, in fsnotify_remove_queued_event() argument
134 assert_spin_locked(&group->notification_lock); in fsnotify_remove_queued_event()
140 group->q_len--; in fsnotify_remove_queued_event()
147 struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group) in fsnotify_remove_first_event() argument
151 assert_spin_locked(&group->notification_lock); in fsnotify_remove_first_event()
153 pr_debug("%s: group=%p\n", __func__, group); in fsnotify_remove_first_event()
155 event = list_first_entry(&group->notification_list, in fsnotify_remove_first_event()
157 fsnotify_remove_queued_event(group, event); in fsnotify_remove_first_event()
165 struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group) in fsnotify_peek_first_event() argument
167 assert_spin_locked(&group->notification_lock); in fsnotify_peek_first_event()
169 return list_first_entry(&group->notification_list, in fsnotify_peek_first_event()
174 * Called when a group is being torn down to clean up any outstanding
177 void fsnotify_flush_notify(struct fsnotify_group *group) in fsnotify_flush_notify() argument
181 spin_lock(&group->notification_lock); in fsnotify_flush_notify()
182 while (!fsnotify_notify_queue_is_empty(group)) { in fsnotify_flush_notify()
183 event = fsnotify_remove_first_event(group); in fsnotify_flush_notify()
184 spin_unlock(&group->notification_lock); in fsnotify_flush_notify()
185 fsnotify_destroy_event(group, event); in fsnotify_flush_notify()
186 spin_lock(&group->notification_lock); in fsnotify_flush_notify()
188 spin_unlock(&group->notification_lock); in fsnotify_flush_notify()