fanotify: simplify the logical of fanotify_merge
Subsystems (3)
PATCH 1/1 fanotify: simplify the logical of fanotify_merge
Signed-off-by Kinglong Mee <[email protected]>
--- fs/notify/fanotify/fanotify.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
fs/notify/fanotify/fanotify.c +3 -8
@@ -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
Signature · 1 line
2.9.3
Amir Goldstein
reviewerOn Wed, Feb 8, 2017 at 2:54 PM, Kinglong Mee <[email protected]> wrote:
Although there is not much to write, I don't think that subject-only patches are encouraged.
For the subject there is a typo s/logical/logic, although I wouldn't go as far as
calling this 'logic', might have used 'simplify the code' instead.
Quoted 40 lines
Signed-off-by Kinglong Mee <[email protected]>--- fs/notify/fanotify/fanotify.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)fs/notify/fanotify/fanotify.c +3
-9@@ -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 --2.9.3
PATCH 1/1 fanotify: simplify the code of fanotify_merge
v2, change the subject to "simplify the code"
Signed-off-by Kinglong Mee <[email protected]>
--- fs/notify/fanotify/fanotify.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
fs/notify/fanotify/fanotify.c +3 -8
@@ -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
Signature · 1 line
2.9.3
Jan Kara
maintainerRe: [PATCH] fanotify: simplify the code of fanotify_merge
Quoted 1 line · Kinglong Mee
v2, change the subject to "simplify the code"
Thanks. I've merged the patch to my tree and will push it to Linus in the merge window.
Honza
Quoted 42 lines
Signed-off-by Kinglong Mee <[email protected]>--- fs/notify/fanotify/fanotify.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)fs/notify/fanotify/fanotify.c +3
-8@@ -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 Signature · 1 line
2.9.3
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR