From: Jes Sorensen <jes.sorensen@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: john@johnmccutchan.com, rlove@rlove.org, eparis@parisplace.org,
josef@toxicpanda.com, kernel-team@fb.com,
Jes Sorensen <jsorensen@fb.com>
Subject: [PATCH 4/5] inotify: switch get_one_event() to use fsnotify_list_*() helpers
Date: Fri, 24 Mar 2017 17:36:37 -0400 [thread overview]
Message-ID: <20170324213638.9114-5-jsorensen@fb.com> (raw)
In-Reply-To: <20170324213638.9114-1-jsorensen@fb.com>
Preparing to switch inotify to code not taking the spinlock for each
event in read()
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
---
fs/notify/inotify/inotify_user.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 6f5b360..4a93750 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -138,18 +138,18 @@ static int round_event_name_len(struct fsnotify_event *fsn_event)
*
* Called with the group->notification_lock held.
*/
-static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
+static struct fsnotify_event *get_one_event(struct list_head *notification_list,
size_t count)
{
size_t event_size = sizeof(struct inotify_event);
struct fsnotify_event *event;
- if (fsnotify_notify_queue_is_empty(group))
+ if (list_empty(notification_list))
return NULL;
- event = fsnotify_peek_first_event(group);
+ event = fsnotify_list_peek_first_event(notification_list);
- pr_debug("%s: group=%p event=%p\n", __func__, group, event);
+ pr_debug("%s: event=%p\n", __func__, event);
event_size += round_event_name_len(event);
if (event_size > count)
@@ -157,7 +157,7 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
/* held the notification_lock the whole time, so this is the
* same event we peeked above */
- fsnotify_remove_first_event(group);
+ fsnotify_list_remove_first_event(notification_list);
return event;
}
@@ -234,7 +234,7 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
add_wait_queue(&group->notification_waitq, &wait);
while (1) {
spin_lock(&group->notification_lock);
- kevent = get_one_event(group, count);
+ kevent = get_one_event(&group->notification_list, count);
spin_unlock(&group->notification_lock);
pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent);
--
2.9.3
next prev parent reply other threads:[~2017-03-24 21:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-24 21:36 [PATCH 0/5] inofify: Reduce lock contention on read() Jes Sorensen
2017-03-24 21:36 ` [PATCH 1/5] notify: Call mutex_destroy() before freeing mutex memory Jes Sorensen
2017-03-24 21:36 ` [PATCH 2/5] inotify: Use mutex to prevent threaded clients reading events out of order Jes Sorensen
2017-03-24 21:36 ` [PATCH 3/5] notify: Split up some fsnotify functions Jes Sorensen
2017-03-24 21:36 ` Jes Sorensen [this message]
2017-03-24 21:36 ` [PATCH 5/5] inotify: Avoid taking spinlock for each event processed in read() Jes Sorensen
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=20170324213638.9114-5-jsorensen@fb.com \
--to=jes.sorensen@gmail.com \
--cc=eparis@parisplace.org \
--cc=john@johnmccutchan.com \
--cc=josef@toxicpanda.com \
--cc=jsorensen@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rlove@rlove.org \
/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
all inboxes | Powered by JetHome®