aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2017-02-09 07:45:22 -0500
committerJan Kara <jack@suse.cz>2017-02-09 08:09:22 -0500
commit6c71100db53e4a0bc0cefce7d9180f5ec10f0f27 (patch)
tree884e6713a98fade3560af54182c7865530106c3c
parenta074faad512605a5bb5f7862e796485e6df572d2 (diff)
fanotify: simplify the code of fanotify_merge
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/notify/fanotify/fanotify.c11
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,
31static int fanotify_merge(struct list_head *list, struct fsnotify_event *event) 31static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
32{ 32{
33 struct fsnotify_event *test_event; 33 struct fsnotify_event *test_event;
34 bool do_merge = false;
35 34
36 pr_debug("%s: list=%p event=%p\n", __func__, list, event); 35 pr_debug("%s: list=%p event=%p\n", __func__, list, event);
37 36
@@ -47,16 +46,12 @@ static int fanotify_merge(struct list_head *list, struct fsnotify_event *event)
47 46
48 list_for_each_entry_reverse(test_event, list, list) { 47 list_for_each_entry_reverse(test_event, list, list) {
49 if (should_merge(test_event, event)) { 48 if (should_merge(test_event, event)) {
50 do_merge = true; 49 test_event->mask |= event->mask;
51 break; 50 return 1;
52 } 51 }
53 } 52 }
54 53
55 if (!do_merge) 54 return 0;
56 return 0;
57
58 test_event->mask |= event->mask;
59 return 1;
60} 55}
61 56
62#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS 57#ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS