summaryrefslogtreecommitdiffstats
path: root/fs/notify/notification.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-01-09 13:15:23 +0100
committerJan Kara <jack@suse.cz>2019-02-18 12:41:16 +0100
commitf7db89accc9c51d8f765d79b8e9557cc623ec20e (patch)
tree1336c33ed4134be538d6d5b9ef1be634a6ae3cf1 /fs/notify/notification.c
parentfanotify: Move locking inside get_one_event() (diff)
downloadlinux-f7db89accc9c51d8f765d79b8e9557cc623ec20e.tar.xz
linux-f7db89accc9c51d8f765d79b8e9557cc623ec20e.zip
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/notification.c')
-rw-r--r--fs/notify/notification.c20
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:
return ret;
}
+void fsnotify_remove_queued_event(struct fsnotify_group *group,
+ struct fsnotify_event *event)
+{
+ assert_spin_locked(&group->notification_lock);
+ /*
+ * We need to init list head for the case of overflow event so that
+ * check in fsnotify_add_event() works
+ */
+ list_del_init(&event->list);
+ group->q_len--;
+}
+
/*
* Remove and return the first event from the notification list. It is the
* responsibility of the caller to destroy the obtained event
@@ -155,13 +167,7 @@ struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
event = list_first_entry(&group->notification_list,
struct fsnotify_event, list);
- /*
- * We need to init list head for the case of overflow event so that
- * check in fsnotify_add_event() works
- */
- list_del_init(&event->list);
- group->q_len--;
-
+ fsnotify_remove_queued_event(group, event);
return event;
}