linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
	Vivek Trivedi <t.vivek@samsung.com>,
	Orion Poplawski <orion@nwra.com>
Subject: Re: [PATCH 3/6] fsnotify: Create function to remove event from notification list
Date: Wed, 13 Feb 2019 22:23:40 +0200	[thread overview]
Message-ID: <CAOQ4uxj2pj2uYuCB4FMB_26edsbcrJRP29rmQJ4zW1rFWs9OuQ@mail.gmail.com> (raw)
In-Reply-To: <20190213145443.26836-4-jack@suse.cz>

On Wed, Feb 13, 2019 at 4:54 PM Jan Kara <jack@suse.cz> wrote:
>
> Create function to remove event from the notification list. Later it will
> be used from more places.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  fs/notify/notification.c         | 20 +++++++++++++-------
>  include/linux/fsnotify_backend.h |  3 +++
>  2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/fs/notify/notification.c b/fs/notify/notification.c
> index 3c3e36745f59..2195a5cf745a 100644
> --- a/fs/notify/notification.c
> +++ b/fs/notify/notification.c
> @@ -141,6 +141,18 @@ int fsnotify_add_event(struct fsnotify_group *group,
>         return ret;
>  }
>
> +void fsnotify_remove_queued_event(struct fsnotify_group *group,
> +                                 struct fsnotify_event *event)
> +{
> +       assert_spin_locked(&group->notification_lock);
> +       /*
> +        * We need to init list head for the case of overflow event so that
> +        * check in fsnotify_add_event() works
> +        */
> +       list_del_init(&event->list);
> +       group->q_len--;
> +}
> +
>  /*
>   * Remove and return the first event from the notification list.  It is the
>   * responsibility of the caller to destroy the obtained event
> @@ -155,13 +167,7 @@ struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group)
>
>         event = list_first_entry(&group->notification_list,
>                                  struct fsnotify_event, list);
> -       /*
> -        * We need to init list head for the case of overflow event so that
> -        * check in fsnotify_add_event() works
> -        */
> -       list_del_init(&event->list);
> -       group->q_len--;
> -
> +       fsnotify_remove_queued_event(group, event);
>         return event;
>  }
>
> diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
> index 7639774e7475..cddf839bac96 100644
> --- a/include/linux/fsnotify_backend.h
> +++ b/include/linux/fsnotify_backend.h
> @@ -416,6 +416,9 @@ extern bool fsnotify_notify_queue_is_empty(struct fsnotify_group *group);
>  extern struct fsnotify_event *fsnotify_peek_first_event(struct fsnotify_group *group);
>  /* return AND dequeue the first event on the notification queue */
>  extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group *group);
> +/* Remove event queued in the notification list */
> +extern void fsnotify_remove_queued_event(struct fsnotify_group *group,
> +                                        struct fsnotify_event *event);
>
>  /* functions used to manipulate the marks attached to inodes */
>
> --
> 2.16.4
>

  reply	other threads:[~2019-02-13 20:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 14:54 [PATCH v2 0/6] fanotify: Make wait for permission event response interruptible Jan Kara
2019-02-13 14:54 ` [PATCH 1/6] fanotify: Fold dequeue_event() into process_access_response() Jan Kara
2019-02-13 19:42   ` Amir Goldstein
2019-02-13 14:54 ` [PATCH 2/6] fanotify: Move locking inside get_one_event() Jan Kara
2019-02-13 20:23   ` Amir Goldstein
2019-02-13 14:54 ` [PATCH 3/6] fsnotify: Create function to remove event from notification list Jan Kara
2019-02-13 20:23   ` Amir Goldstein [this message]
2019-02-13 14:54 ` [PATCH 4/6] fanotify: Simplify cleaning of access_list Jan Kara
2019-02-13 20:25   ` Amir Goldstein
2019-02-13 14:54 ` [PATCH 5/6] fanotify: Track permission event state Jan Kara
2019-02-13 20:33   ` Amir Goldstein
2019-02-13 14:54 ` [PATCH 6/6] fanotify: Use interruptible wait when waiting for permission events Jan Kara
2019-02-13 21:02   ` Amir Goldstein
2019-02-14 18:01     ` Jan Kara
2019-02-14 18:53       ` Amir Goldstein
2019-02-18 11:04         ` Jan Kara
2019-02-20 17:27 ` [PATCH v2 0/6] fanotify: Make wait for permission event response interruptible Orion Poplawski
2019-02-21  9:02   ` Marko Rauhamaa
2019-02-21 10:53   ` Jan Kara
2019-02-21 10:55     ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQ4uxj2pj2uYuCB4FMB_26edsbcrJRP29rmQJ4zW1rFWs9OuQ@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=jack@suse.cz \
    --cc=khlebnikov@yandex-team.ru \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=orion@nwra.com \
    --cc=t.vivek@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).