]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
fanotify: simplify the code of fanotify_merge
authorKinglong Mee <kinglongmee@gmail.com>
Thu, 9 Feb 2017 12:45:22 +0000 (20:45 +0800)
committerJan Kara <jack@suse.cz>
Thu, 9 Feb 2017 13:09:22 +0000 (14:09 +0100)
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/notify/fanotify/fanotify.c

index bbc175d4213d5776e65ee9a438cf4e90f8c0f6c2..a4c46221755ea6e2ed743ac1d060a6ab40b45070 100644 (file)
@@ -31,7 +31,6 @@ static bool should_merge(struct fsnotify_event *old_fsn,
 static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
 {
        struct fsnotify_event *test_event;
-       bool do_merge = false;
 
        pr_debug("%s: list=%p event=%p\n", __func__, list, event);
 
@@ -47,16 +46,12 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
 
        list_for_each_entry_reverse(test_event, list, list) {
                if (should_merge(test_event, event)) {
-                       do_merge = true;
-                       break;
+                       test_event->mask |= event->mask;
+                       return 1;
                }
        }
 
-       if (!do_merge)
-               return 0;
-
-       test_event->mask |= event->mask;
-       return 1;
+       return 0;
 }
 
 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS