From: Dave Hansen <dave@sr71.net>
To: dave@sr71.net
Cc: jack@suse.cz, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
paulmck@linux.vnet.ibm.com, tim.c.chen@linux.intel.com,
ak@linux.intel.com, dave.hansen@linux.intel.com
Subject: [RFCv2][PATCH 6/7] fsnotify: change fsnotify_recalc_mask() conventions
Date: Wed, 24 Jun 2015 17:16:08 -0700 [thread overview]
Message-ID: <20150625001608.BD776A31@viggo.jf.intel.com> (raw)
In-Reply-To: <20150625001605.72553909@viggo.jf.intel.com>
From: Dave Hansen <dave.hansen@linux.intel.com>
fsnotify_recalc_mask() currently takes a list of fsnotify_marks
and calculates a mask from them. Now that we store the marks
and the masks together in a fsnotify_head, just pass the whole
thing in and have fsnotify_recalc_mask() set ->mask internally.
Cc: Jan Kara <jack@suse.cz>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
---
b/fs/notify/fsnotify.h | 5 +++--
b/fs/notify/inode_mark.c | 6 +++---
b/fs/notify/mark.c | 8 +++++---
b/fs/notify/vfsmount_mark.c | 6 +++---
4 files changed, 14 insertions(+), 11 deletions(-)
diff -puN fs/notify/fsnotify.h~fsnotify_recalc_mask-redo fs/notify/fsnotify.h
--- a/fs/notify/fsnotify.h~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.757207417 -0700
+++ b/fs/notify/fsnotify.h 2015-06-24 17:14:36.766207822 -0700
@@ -3,6 +3,7 @@
#include <linux/list.h>
#include <linux/fsnotify.h>
+#include <linux/fsnotify_head.h>
#include <linux/srcu.h>
#include <linux/types.h>
@@ -12,8 +13,8 @@ extern void fsnotify_flush_notify(struct
/* protects reads of inode and vfsmount marks list */
extern struct srcu_struct fsnotify_mark_srcu;
-/* Calculate mask of events for a list of marks */
-extern u32 fsnotify_recalc_mask(struct hlist_head *head);
+/* Recalculate the fsnotify_head's mask from its marks */
+extern void fsnotify_recalc_mask(struct fsnotify_head *fsn);
/* compare two groups for sorting of marks lists */
extern int fsnotify_compare_groups(struct fsnotify_group *a,
diff -puN fs/notify/inode_mark.c~fsnotify_recalc_mask-redo fs/notify/inode_mark.c
--- a/fs/notify/inode_mark.c~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.759207507 -0700
+++ b/fs/notify/inode_mark.c 2015-06-24 17:14:36.766207822 -0700
@@ -37,7 +37,7 @@
void fsnotify_recalc_inode_mask(struct inode *inode)
{
spin_lock(&inode->i_lock);
- inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+ fsnotify_recalc_mask(&inode->i_fsnotify);
spin_unlock(&inode->i_lock);
__fsnotify_update_child_dentry_flags(inode);
@@ -60,7 +60,7 @@ void fsnotify_destroy_inode_mark(struct
* hold the inode->i_lock, so this is the perfect time to update the
* inode->i_fsnotify.mask
*/
- inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+ fsnotify_recalc_mask(&inode->i_fsnotify);
spin_unlock(&inode->i_lock);
}
@@ -155,7 +155,7 @@ int fsnotify_add_inode_mark(struct fsnot
mark->inode = inode;
ret = fsnotify_add_mark_list(&inode->i_fsnotify.marks, mark,
allow_dups);
- inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+ fsnotify_recalc_mask(&inode->i_fsnotify);
spin_unlock(&inode->i_lock);
return ret;
diff -puN fs/notify/mark.c~fsnotify_recalc_mask-redo fs/notify/mark.c
--- a/fs/notify/mark.c~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.760207552 -0700
+++ b/fs/notify/mark.c 2015-06-24 17:14:36.765207777 -0700
@@ -89,6 +89,7 @@
#include <linux/atomic.h>
#include <linux/fsnotify_backend.h>
+#include <linux/fsnotify_head.h>
#include "fsnotify.h"
struct srcu_struct fsnotify_mark_srcu;
@@ -111,14 +112,15 @@ void fsnotify_put_mark(struct fsnotify_m
}
/* Calculate mask of events for a list of marks */
-u32 fsnotify_recalc_mask(struct hlist_head *head)
+void fsnotify_recalc_mask(struct fsnotify_head *fsn)
{
u32 new_mask = 0;
struct fsnotify_mark *mark;
- hlist_for_each_entry(mark, head, obj_list)
+ hlist_for_each_entry(mark, &fsn->marks, obj_list)
new_mask |= mark->mask;
- return new_mask;
+
+ fsn->mask = new_mask;
}
/*
diff -puN fs/notify/vfsmount_mark.c~fsnotify_recalc_mask-redo fs/notify/vfsmount_mark.c
--- a/fs/notify/vfsmount_mark.c~fsnotify_recalc_mask-redo 2015-06-24 17:14:36.762207642 -0700
+++ b/fs/notify/vfsmount_mark.c 2015-06-24 17:14:36.766207822 -0700
@@ -62,7 +62,7 @@ void fsnotify_recalc_vfsmount_mask(struc
struct mount *m = real_mount(mnt);
spin_lock(&mnt->mnt_root->d_lock);
- m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+ fsnotify_recalc_mask(&m->mnt_fsnotify);
spin_unlock(&mnt->mnt_root->d_lock);
}
@@ -79,7 +79,7 @@ void fsnotify_destroy_vfsmount_mark(stru
hlist_del_init_rcu(&mark->obj_list);
mark->mnt = NULL;
- m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+ fsnotify_recalc_mask(&m->mnt_fsnotify);
spin_unlock(&mnt->mnt_root->d_lock);
}
@@ -120,7 +120,7 @@ int fsnotify_add_vfsmount_mark(struct fs
spin_lock(&mnt->mnt_root->d_lock);
mark->mnt = mnt;
ret = fsnotify_add_mark_list(&m->mnt_fsnotify.marks, mark, allow_dups);
- m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+ fsnotify_recalc_mask(&m->mnt_fsnotify);
spin_unlock(&mnt->mnt_root->d_lock);
return ret;
_
next prev parent reply other threads:[~2015-06-25 0:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 0:16 [RFCv2][PATCH 1/7] fs: optimize inotify/fsnotify code for unwatched files Dave Hansen
2015-06-25 0:16 ` [RFCv2][PATCH 2/7] fs: use RCU for free_super() vs. __sb_start_write() Dave Hansen
2015-06-26 12:59 ` Jan Kara
2015-06-25 0:16 ` [RFCv2][PATCH 3/7] fs: fsnotify: replace memory barrier in __sb_end_write() with RCU Dave Hansen
2015-06-26 13:07 ` Jan Kara
2015-06-25 0:16 ` [RFCv2][PATCH 4/7] fsnotify: encapsulate embedded fsnotify data in a single spot Dave Hansen
2015-06-26 13:19 ` Jan Kara
2015-06-25 0:16 ` [RFCv2][PATCH 5/7] fsnotify: use fsnotify_head for vfsmount data Dave Hansen
2015-06-25 0:16 ` [RFCv2][PATCH 7/7] fsnotify: track when ignored mask clearing is needed Dave Hansen
2015-06-26 13:26 ` Jan Kara
2015-06-25 0:16 ` Dave Hansen [this message]
2015-06-25 0:57 ` [RFCv2][PATCH 1/7] fs: optimize inotify/fsnotify code for unwatched files Eric Paris
2015-06-25 16:28 ` Dave Hansen
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=20150625001608.BD776A31@viggo.jf.intel.com \
--to=dave@sr71.net \
--cc=ak@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=tim.c.chen@linux.intel.com \
--cc=viro@zeniv.linux.org.uk \
/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®