diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2017-02-09 20:45:22 +0800 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-02-09 14:09:22 +0100 |
commit | 6c71100db53e4a0bc0cefce7d9180f5ec10f0f27 (patch) | |
tree | 884e6713a98fade3560af54182c7865530106c3c /fs/notify/fanotify/fanotify.c | |
parent | a074faad512605a5bb5f7862e796485e6df572d2 (diff) | |
download | lwn-6c71100db53e4a0bc0cefce7d9180f5ec10f0f27.tar.gz lwn-6c71100db53e4a0bc0cefce7d9180f5ec10f0f27.zip |
fanotify: simplify the code of fanotify_merge
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify/fanotify.c')
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index bbc175d4213d..a4c46221755e 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -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 |