Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1171763
| From | Dave Hansen <dave@sr71.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFCv2][PATCH 5/7] fsnotify: use fsnotify_head for vfsmount data |
| Date | 2015-06-25 02:20 +0200 |
| Message-ID | <pF33A-on-13@gated-at.bofh.it> (permalink) |
| References | <pF33z-on-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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;
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFCv2][PATCH 1/7] fs: optimize inotify/fsnotify code for unwatched files Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 [RFCv2][PATCH 2/7] fs: use RCU for free_super() vs. __sb_start_write() Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 [RFCv2][PATCH 3/7] fs: fsnotify: replace memory barrier in __sb_end_write() with RCU Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 [RFCv2][PATCH 4/7] fsnotify: encapsulate embedded fsnotify data in a single spot Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 [RFCv2][PATCH 5/7] fsnotify: use fsnotify_head for vfsmount data Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 [RFCv2][PATCH 7/7] fsnotify: track when ignored mask clearing is needed Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 [RFCv2][PATCH 6/7] fsnotify: change fsnotify_recalc_mask() conventions Dave Hansen <dave@sr71.net> - 2015-06-25 02:20 +0200 Re: [RFCv2][PATCH 1/7] fs: optimize inotify/fsnotify code for unwatched files Eric Paris <eparis@redhat.com> - 2015-06-25 03:00 +0200
csiph-web