]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
fsnotify: Create function to remove event from notification list
authorJan Kara <jack@suse.cz>
Wed, 9 Jan 2019 12:15:23 +0000 (13:15 +0100)
committerJan Kara <jack@suse.cz>
Mon, 18 Feb 2019 11:41:16 +0000 (12:41 +0100)
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>
fs/notify/notification.c
include/linux/fsnotify_backend.h

index 027d5d5bb90e3005131c8ccf7debd48fc08551f6..5f3a54d444b50b272d51ec11f9fac0b036bbeb2d 100644 (file)
@@ -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;
 }
 
index 7b93f15b4944a4befb67c5f18f808a0cd00aea48..dfc28fcb4de8c1268d14b4cfceac4900bf8bf578 100644 (file)
@@ -422,6 +422,9 @@ extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
 extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
 /* return AND dequeue the first event on the notification queue */
 extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
+/* Remove event queued in the notification list */
+extern void fsnotify_remove_queued_event(struct fsnotify_group *group,
+                                        struct fsnotify_event *event);
 
 /* functions used to manipulate the marks attached to inodes */