* [PATCH] fanotify: simplify the logical of fanotify_merge
@ 2017-02-08 12:54 Kinglong Mee
2017-02-08 13:53 ` Amir Goldstein
0 siblings, 1 reply; 4+ messages in thread
From: Kinglong Mee @ 2017-02-08 12:54 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Eric Paris, Kinglong Mee, Al Viro
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fs/notify/fanotify/fanotify.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index bbc175d..a4c4622 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
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fanotify: simplify the logical of fanotify_merge
2017-02-08 12:54 [PATCH] fanotify: simplify the logical of fanotify_merge Kinglong Mee
@ 2017-02-08 13:53 ` Amir Goldstein
2017-02-09 12:45 ` [PATCH] fanotify: simplify the code " Kinglong Mee
0 siblings, 1 reply; 4+ messages in thread
From: Amir Goldstein @ 2017-02-08 13:53 UTC (permalink / raw)
To: Kinglong Mee; +Cc: linux-fsdevel, Eric Paris, Al Viro, Jan Kara
On Wed, Feb 8, 2017 at 2:54 PM, Kinglong Mee <kinglongmee@gmail.com> 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.
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
> fs/notify/fanotify/fanotify.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
> index bbc175d..a4c4622 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
> --
> 2.9.3
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] fanotify: simplify the code of fanotify_merge
2017-02-08 13:53 ` Amir Goldstein
@ 2017-02-09 12:45 ` Kinglong Mee
2017-02-09 13:09 ` Jan Kara
0 siblings, 1 reply; 4+ messages in thread
From: Kinglong Mee @ 2017-02-09 12:45 UTC (permalink / raw)
To: Eric Paris; +Cc: Amir Goldstein, linux-fsdevel, Al Viro, Jan Kara, Kinglong Mee
v2, change the subject to "simplify the code"
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
fs/notify/fanotify/fanotify.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index bbc175d..a4c4622 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
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fanotify: simplify the code of fanotify_merge
2017-02-09 12:45 ` [PATCH] fanotify: simplify the code " Kinglong Mee
@ 2017-02-09 13:09 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2017-02-09 13:09 UTC (permalink / raw)
To: Kinglong Mee; +Cc: Eric Paris, Amir Goldstein, linux-fsdevel, Al Viro, Jan Kara
On Thu 09-02-17 20:45:22, Kinglong Mee wrote:
> 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
>
> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
> ---
> fs/notify/fanotify/fanotify.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
> index bbc175d..a4c4622 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
> --
> 2.9.3
>
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-09 13:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 12:54 [PATCH] fanotify: simplify the logical of fanotify_merge Kinglong Mee
2017-02-08 13:53 ` Amir Goldstein
2017-02-09 12:45 ` [PATCH] fanotify: simplify the code " Kinglong Mee
2017-02-09 13:09 ` Jan Kara
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.