aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-11-25 02:35:16 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:57:12 -0500
commitc63181e6b6df89176b3984c6977bb5ec03d0df23 (patch)
tree2e6056a7d85e8df9dbf95e6fa4291f76a714c7c8 /fs/notify
parent52ba1621de1479ce7e52b6d167860462e483313c (diff)
vfs: move fsnotify junk to struct mount
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/fanotify/fanotify_user.c6
-rw-r--r--fs/notify/fsnotify.c9
-rw-r--r--fs/notify/vfsmount_mark.c19
3 files changed, 21 insertions, 13 deletions
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 9fde1c00a296..3568c8a8b138 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -16,6 +16,8 @@
16 16
17#include <asm/ioctls.h> 17#include <asm/ioctls.h>
18 18
19#include "../../mount.h"
20
19#define FANOTIFY_DEFAULT_MAX_EVENTS 16384 21#define FANOTIFY_DEFAULT_MAX_EVENTS 16384
20#define FANOTIFY_DEFAULT_MAX_MARKS 8192 22#define FANOTIFY_DEFAULT_MAX_MARKS 8192
21#define FANOTIFY_DEFAULT_MAX_LISTENERS 128 23#define FANOTIFY_DEFAULT_MAX_LISTENERS 128
@@ -546,7 +548,7 @@ static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group,
546 548
547 removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); 549 removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags);
548 fsnotify_put_mark(fsn_mark); 550 fsnotify_put_mark(fsn_mark);
549 if (removed & mnt->mnt_fsnotify_mask) 551 if (removed & real_mount(mnt)->mnt_fsnotify_mask)
550 fsnotify_recalc_vfsmount_mask(mnt); 552 fsnotify_recalc_vfsmount_mask(mnt);
551 553
552 return 0; 554 return 0;
@@ -623,7 +625,7 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
623 } 625 }
624 added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); 626 added = fanotify_mark_add_to_mask(fsn_mark, mask, flags);
625 627
626 if (added & ~mnt->mnt_fsnotify_mask) 628 if (added & ~real_mount(mnt)->mnt_fsnotify_mask)
627 fsnotify_recalc_vfsmount_mask(mnt); 629 fsnotify_recalc_vfsmount_mask(mnt);
628err: 630err:
629 fsnotify_put_mark(fsn_mark); 631 fsnotify_put_mark(fsn_mark);
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 79b47cbb5cd8..ccb14d3fc0de 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -26,6 +26,7 @@
26 26
27#include <linux/fsnotify_backend.h> 27#include <linux/fsnotify_backend.h>
28#include "fsnotify.h" 28#include "fsnotify.h"
29#include "../mount.h"
29 30
30/* 31/*
31 * Clear all of the marks on an inode when it is being evicted from core 32 * Clear all of the marks on an inode when it is being evicted from core
@@ -205,13 +206,13 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
205 struct fsnotify_mark *inode_mark = NULL, *vfsmount_mark = NULL; 206 struct fsnotify_mark *inode_mark = NULL, *vfsmount_mark = NULL;
206 struct fsnotify_group *inode_group, *vfsmount_group; 207 struct fsnotify_group *inode_group, *vfsmount_group;
207 struct fsnotify_event *event = NULL; 208 struct fsnotify_event *event = NULL;
208 struct vfsmount *mnt; 209 struct mount *mnt;
209 int idx, ret = 0; 210 int idx, ret = 0;
210 /* global tests shouldn't care about events on child only the specific event */ 211 /* global tests shouldn't care about events on child only the specific event */
211 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); 212 __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD);
212 213
213 if (data_is == FSNOTIFY_EVENT_PATH) 214 if (data_is == FSNOTIFY_EVENT_PATH)
214 mnt = ((struct path *)data)->mnt; 215 mnt = real_mount(((struct path *)data)->mnt);
215 else 216 else
216 mnt = NULL; 217 mnt = NULL;
217 218
@@ -262,11 +263,11 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
262 /* we didn't use the vfsmount_mark */ 263 /* we didn't use the vfsmount_mark */
263 vfsmount_group = NULL; 264 vfsmount_group = NULL;
264 } else if (vfsmount_group > inode_group) { 265 } else if (vfsmount_group > inode_group) {
265 ret = send_to_group(to_tell, mnt, NULL, vfsmount_mark, mask, data, 266 ret = send_to_group(to_tell, &mnt->mnt, NULL, vfsmount_mark, mask, data,
266 data_is, cookie, file_name, &event); 267 data_is, cookie, file_name, &event);
267 inode_group = NULL; 268 inode_group = NULL;
268 } else { 269 } else {
269 ret = send_to_group(to_tell, mnt, inode_mark, vfsmount_mark, 270 ret = send_to_group(to_tell, &mnt->mnt, inode_mark, vfsmount_mark,
270 mask, data, data_is, cookie, file_name, 271 mask, data, data_is, cookie, file_name,
271 &event); 272 &event);
272 } 273 }
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c
index 778fe6cae3b0..b7b4b0e8554f 100644
--- a/fs/notify/vfsmount_mark.c
+++ b/fs/notify/vfsmount_mark.c
@@ -28,15 +28,17 @@
28 28
29#include <linux/fsnotify_backend.h> 29#include <linux/fsnotify_backend.h>
30#include "fsnotify.h" 30#include "fsnotify.h"
31#include "../mount.h"
31 32
32void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) 33void fsnotify_clear_marks_by_mount(struct vfsmount *mnt)
33{ 34{
34 struct fsnotify_mark *mark, *lmark; 35 struct fsnotify_mark *mark, *lmark;
35 struct hlist_node *pos, *n; 36 struct hlist_node *pos, *n;
37 struct mount *m = real_mount(mnt);
36 LIST_HEAD(free_list); 38 LIST_HEAD(free_list);
37 39
38 spin_lock(&mnt->mnt_root->d_lock); 40 spin_lock(&mnt->mnt_root->d_lock);
39 hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) { 41 hlist_for_each_entry_safe(mark, pos, n, &m->mnt_fsnotify_marks, m.m_list) {
40 list_add(&mark->m.free_m_list, &free_list); 42 list_add(&mark->m.free_m_list, &free_list);
41 hlist_del_init_rcu(&mark->m.m_list); 43 hlist_del_init_rcu(&mark->m.m_list);
42 fsnotify_get_mark(mark); 44 fsnotify_get_mark(mark);
@@ -59,15 +61,16 @@ void fsnotify_clear_vfsmount_marks_by_group(struct fsnotify_group *group)
59 */ 61 */
60static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt) 62static void fsnotify_recalc_vfsmount_mask_locked(struct vfsmount *mnt)
61{ 63{
64 struct mount *m = real_mount(mnt);
62 struct fsnotify_mark *mark; 65 struct fsnotify_mark *mark;
63 struct hlist_node *pos; 66 struct hlist_node *pos;
64 __u32 new_mask = 0; 67 __u32 new_mask = 0;
65 68
66 assert_spin_locked(&mnt->mnt_root->d_lock); 69 assert_spin_locked(&mnt->mnt_root->d_lock);
67 70
68 hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) 71 hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list)
69 new_mask |= mark->mask; 72 new_mask |= mark->mask;
70 mnt->mnt_fsnotify_mask = new_mask; 73 m->mnt_fsnotify_mask = new_mask;
71} 74}
72 75
73/* 76/*
@@ -101,12 +104,13 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark)
101static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group, 104static struct fsnotify_mark *fsnotify_find_vfsmount_mark_locked(struct fsnotify_group *group,
102 struct vfsmount *mnt) 105 struct vfsmount *mnt)
103{ 106{
107 struct mount *m = real_mount(mnt);
104 struct fsnotify_mark *mark; 108 struct fsnotify_mark *mark;
105 struct hlist_node *pos; 109 struct hlist_node *pos;
106 110
107 assert_spin_locked(&mnt->mnt_root->d_lock); 111 assert_spin_locked(&mnt->mnt_root->d_lock);
108 112
109 hlist_for_each_entry(mark, pos, &mnt->mnt_fsnotify_marks, m.m_list) { 113 hlist_for_each_entry(mark, pos, &m->mnt_fsnotify_marks, m.m_list) {
110 if (mark->group == group) { 114 if (mark->group == group) {
111 fsnotify_get_mark(mark); 115 fsnotify_get_mark(mark);
112 return mark; 116 return mark;
@@ -140,6 +144,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
140 struct fsnotify_group *group, struct vfsmount *mnt, 144 struct fsnotify_group *group, struct vfsmount *mnt,
141 int allow_dups) 145 int allow_dups)
142{ 146{
147 struct mount *m = real_mount(mnt);
143 struct fsnotify_mark *lmark; 148 struct fsnotify_mark *lmark;
144 struct hlist_node *node, *last = NULL; 149 struct hlist_node *node, *last = NULL;
145 int ret = 0; 150 int ret = 0;
@@ -154,13 +159,13 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark,
154 mark->m.mnt = mnt; 159 mark->m.mnt = mnt;
155 160
156 /* is mark the first mark? */ 161 /* is mark the first mark? */
157 if (hlist_empty(&mnt->mnt_fsnotify_marks)) { 162 if (hlist_empty(&m->mnt_fsnotify_marks)) {
158 hlist_add_head_rcu(&mark->m.m_list, &mnt->mnt_fsnotify_marks); 163 hlist_add_head_rcu(&mark->m.m_list, &m->mnt_fsnotify_marks);
159 goto out; 164 goto out;
160 } 165 }
161 166
162 /* should mark be in the middle of the current list? */ 167 /* should mark be in the middle of the current list? */
163 hlist_for_each_entry(lmark, node, &mnt->mnt_fsnotify_marks, m.m_list) { 168 hlist_for_each_entry(lmark, node, &m->mnt_fsnotify_marks, m.m_list) {
164 last = node; 169 last = node;
165 170
166 if ((lmark->group == group) && !allow_dups) { 171 if ((lmark->group == group) && !allow_dups) {