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 5/7] fsnotify: use fsnotify_head for vfsmount data
Date: Wed, 24 Jun 2015 17:16:07 -0700 [thread overview]
Message-ID: <20150625001607.05D8CFF9@viggo.jf.intel.com> (raw)
In-Reply-To: <20150625001605.72553909@viggo.jf.intel.com>
From: Dave Hansen <dave.hansen@linux.intel.com>
Use the new 'struct fsnotify_head' for the vfsmount fsnotify data,
just like we did for inodes in the last patch.
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/mount.h | 6 ++----
b/fs/namespace.c | 2 +-
b/fs/notify/fanotify/fanotify_user.c | 4 ++--
b/fs/notify/fsnotify.c | 8 ++++----
b/fs/notify/vfsmount_mark.c | 14 +++++++-------
5 files changed, 16 insertions(+), 18 deletions(-)
diff -puN fs/mount.h~fsnotify_head_mnt fs/mount.h
--- a/fs/mount.h~fsnotify_head_mnt 2015-06-24 17:14:36.276185800 -0700
+++ b/fs/mount.h 2015-06-24 17:14:36.286186250 -0700
@@ -3,6 +3,7 @@
#include <linux/poll.h>
#include <linux/ns_common.h>
#include <linux/fs_pin.h>
+#include <linux/fsnotify_head.h>
struct mnt_namespace {
atomic_t count;
@@ -55,10 +56,7 @@ struct mount {
struct mnt_namespace *mnt_ns; /* containing namespace */
struct mountpoint *mnt_mp; /* where is it mounted */
struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */
-#ifdef CONFIG_FSNOTIFY
- struct hlist_head mnt_fsnotify_marks;
- __u32 mnt_fsnotify_mask;
-#endif
+ struct fsnotify_head mnt_fsnotify;
int mnt_id; /* mount identifier */
int mnt_group_id; /* peer group identifier */
int mnt_expiry_mark; /* true if marked for expiry */
diff -puN fs/namespace.c~fsnotify_head_mnt fs/namespace.c
--- a/fs/namespace.c~fsnotify_head_mnt 2015-06-24 17:14:36.278185890 -0700
+++ b/fs/namespace.c 2015-06-24 17:14:36.287186295 -0700
@@ -235,7 +235,7 @@ static struct mount *alloc_vfsmnt(const
INIT_LIST_HEAD(&mnt->mnt_slave);
INIT_HLIST_NODE(&mnt->mnt_mp_list);
#ifdef CONFIG_FSNOTIFY
- INIT_HLIST_HEAD(&mnt->mnt_fsnotify_marks);
+ INIT_HLIST_HEAD(&mnt->mnt_fsnotify.marks);
#endif
init_fs_pin(&mnt->mnt_umount, drop_mountpoint);
}
diff -puN fs/notify/fanotify/fanotify_user.c~fsnotify_head_mnt fs/notify/fanotify/fanotify_user.c
--- a/fs/notify/fanotify/fanotify_user.c~fsnotify_head_mnt 2015-06-24 17:14:36.279185935 -0700
+++ b/fs/notify/fanotify/fanotify_user.c 2015-06-24 17:14:36.287186295 -0700
@@ -533,7 +533,7 @@ static int fanotify_remove_vfsmount_mark
mutex_unlock(&group->mark_mutex);
fsnotify_put_mark(fsn_mark);
- if (removed & real_mount(mnt)->mnt_fsnotify_mask)
+ if (removed & real_mount(mnt)->mnt_fsnotify.mask)
fsnotify_recalc_vfsmount_mask(mnt);
return 0;
@@ -641,7 +641,7 @@ static int fanotify_add_vfsmount_mark(st
added = fanotify_mark_add_to_mask(fsn_mark, mask, flags);
mutex_unlock(&group->mark_mutex);
- if (added & ~real_mount(mnt)->mnt_fsnotify_mask)
+ if (added & ~real_mount(mnt)->mnt_fsnotify.mask)
fsnotify_recalc_vfsmount_mask(mnt);
fsnotify_put_mark(fsn_mark);
diff -puN fs/notify/fsnotify.c~fsnotify_head_mnt fs/notify/fsnotify.c
--- a/fs/notify/fsnotify.c~fsnotify_head_mnt 2015-06-24 17:14:36.281186025 -0700
+++ b/fs/notify/fsnotify.c 2015-06-24 17:14:36.288186339 -0700
@@ -211,7 +211,7 @@ int fsnotify(struct inode *to_tell, __u3
*/
if (!(mask & FS_MODIFY) &&
!(test_mask & to_tell->i_fsnotify.mask) &&
- !(mnt && test_mask & mnt->mnt_fsnotify_mask))
+ !(mnt && test_mask & mnt->mnt_fsnotify.mask))
return 0;
/*
* Optimization: srcu_read_lock() has a memory barrier which can
@@ -221,7 +221,7 @@ int fsnotify(struct inode *to_tell, __u3
* need SRCU to keep them "alive".
*/
if (!to_tell->i_fsnotify.marks.first &&
- (!mnt || !mnt->mnt_fsnotify_marks.first))
+ (!mnt || !mnt->mnt_fsnotify.marks.first))
return 0;
idx = srcu_read_lock(&fsnotify_mark_srcu);
@@ -232,8 +232,8 @@ int fsnotify(struct inode *to_tell, __u3
&fsnotify_mark_srcu);
if (mnt && ((mask & FS_MODIFY) ||
- (test_mask & mnt->mnt_fsnotify_mask))) {
- vfsmount_node = srcu_dereference(mnt->mnt_fsnotify_marks.first,
+ (test_mask & mnt->mnt_fsnotify.mask))) {
+ vfsmount_node = srcu_dereference(mnt->mnt_fsnotify.marks.first,
&fsnotify_mark_srcu);
inode_node = srcu_dereference(to_tell->i_fsnotify.marks.first,
&fsnotify_mark_srcu);
diff -puN fs/notify/vfsmount_mark.c~fsnotify_head_mnt fs/notify/vfsmount_mark.c
--- a/fs/notify/vfsmount_mark.c~fsnotify_head_mnt 2015-06-24 17:14:36.282186070 -0700
+++ b/fs/notify/vfsmount_mark.c 2015-06-24 17:14:36.288186339 -0700
@@ -38,7 +38,7 @@ void fsnotify_clear_marks_by_mount(struc
LIST_HEAD(free_list);
spin_lock(&mnt->mnt_root->d_lock);
- hlist_for_each_entry_safe(mark, n, &m->mnt_fsnotify_marks, obj_list) {
+ hlist_for_each_entry_safe(mark, n, &m->mnt_fsnotify.marks, obj_list) {
list_add(&mark->free_list, &free_list);
hlist_del_init_rcu(&mark->obj_list);
fsnotify_get_mark(mark);
@@ -54,7 +54,7 @@ void fsnotify_clear_vfsmount_marks_by_gr
}
/*
- * Recalculate the mnt->mnt_fsnotify_mask, or the mask of all FS_* event types
+ * Recalculate the mnt->mnt_fsnotify.mask, or the mask of all FS_* event types
* any notifier is interested in hearing for this mount point
*/
void fsnotify_recalc_vfsmount_mask(struct vfsmount *mnt)
@@ -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);
+ m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
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);
+ m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
spin_unlock(&mnt->mnt_root->d_lock);
}
@@ -94,7 +94,7 @@ struct fsnotify_mark *fsnotify_find_vfsm
struct fsnotify_mark *mark;
spin_lock(&mnt->mnt_root->d_lock);
- mark = fsnotify_find_mark(&m->mnt_fsnotify_marks, group);
+ mark = fsnotify_find_mark(&m->mnt_fsnotify.marks, group);
spin_unlock(&mnt->mnt_root->d_lock);
return mark;
@@ -119,8 +119,8 @@ 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);
+ ret = fsnotify_add_mark_list(&m->mnt_fsnotify.marks, mark, allow_dups);
+ m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
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 ` Dave Hansen [this message]
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 ` [RFCv2][PATCH 6/7] fsnotify: change fsnotify_recalc_mask() conventions Dave Hansen
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=20150625001607.05D8CFF9@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
Powered by JetHome