diff options
author | Jan Kara <jack@suse.cz> | 2019-01-09 07:15:23 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2019-02-18 06:41:16 -0500 |
commit | f7db89accc9c51d8f765d79b8e9557cc623ec20e (patch) | |
tree | 1336c33ed4134be538d6d5b9ef1be634a6ae3cf1 /fs/notify | |
parent | 8c5544666c9d88046bfd60aa7d5fea5c6d3d59bd (diff) |
fsnotify: Create function to remove event from notification list
Create function to remove event from the notification list. Later it will
be used from more places.
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/notification.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/notify/notification.c b/fs/notify/notification.c index 027d5d5bb90e..5f3a54d444b5 100644 --- a/fs/notify/notification.c +++ b/fs/notify/notification.c | |||
@@ -141,6 +141,18 @@ queue: | |||
141 | return ret; | 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 | * Remove and return the first event from the notification list. It is the | 157 | * Remove and return the first event from the notification list. It is the |
146 | * responsibility of the caller to destroy the obtained event | 158 | * responsibility of the caller to destroy the obtained event |
@@ -155,13 +167,7 @@ struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group) | |||
155 | 167 | ||
156 | event = list_first_entry(&group->notification_list, | 168 | event = list_first_entry(&group->notification_list, |
157 | struct fsnotify_event, list); | 169 | struct fsnotify_event, list); |
158 | /* | 170 | fsnotify_remove_queued_event(group, event); |
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 | |||
165 | return event; | 171 | return event; |
166 | } | 172 | } |
167 | 173 | ||