Source
134
134
queue:
135
135
group->q_len++;
136
136
list_add_tail(&event->list, list);
137
137
spin_unlock(&group->notification_lock);
138
138
139
139
wake_up(&group->notification_waitq);
140
140
kill_fasync(&group->fsn_fa, SIGIO, POLL_IN);
141
141
return ret;
142
142
}
143
143
144
+
void fsnotify_remove_queued_event(struct fsnotify_group *group,
145
+
struct fsnotify_event *event)
146
+
{
147
+
assert_spin_locked(&group->notification_lock);
148
+
/*
149
+
* We need to init list head for the case of overflow event so that
150
+
* check in fsnotify_add_event() works
151
+
*/
152
+
list_del_init(&event->list);
153
+
group->q_len--;
154
+
}
155
+
144
156
/*
145
157
* Remove and return the first event from the notification list. It is the
146
158
* responsibility of the caller to destroy the obtained event
147
159
*/
148
160
struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
149
161
{
150
162
struct fsnotify_event *event;
151
163
152
164
assert_spin_locked(&group->notification_lock);
153
165
154
166
pr_debug("%s: group=%p\n", __func__, group);
155
167
156
168
event = list_first_entry(&group->notification_list,
157
169
struct fsnotify_event, list);
158
-
/*
159
-
* We need to init list head for the case of overflow event so that
160
-
* check in fsnotify_add_event() works
161
-
*/
162
-
list_del_init(&event->list);
163
-
group->q_len--;
164
-
170
+
fsnotify_remove_queued_event(group, event);
165
171
return event;
166
172
}
167
173
168
174
/*
169
175
* This will not remove the event, that must be done with
170
176
* fsnotify_remove_first_event()
171
177
*/
172
178
struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group)
173
179
{
174
180
assert_spin_locked(&group->notification_lock);