diff options
author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:38 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:51 -0400 |
commit | a4c6e9961fcb9da54648d98978d33c6fdcb7bb45 (patch) | |
tree | a109069ccd818ce9fd84f1ef1f0234e8452eb317 | |
parent | 0c6532e4e3b0c8bd18dd0a5cc1894a1944997cc6 (diff) |
fsnotify: use _rcu functions for mark list traversal
In preparation for srcu locking use all _rcu appropiete functions for mark
list addition, removal, and traversal. The operations are still done under a
spinlock at the end of this patch.
Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r-- | fs/notify/inode_mark.c | 10 | ||||
-rw-r--r-- | fs/notify/vfsmount_mark.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index 83ce6db34039..455cb41c729b 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
@@ -67,7 +67,7 @@ void fsnotify_destroy_inode_mark(struct fsnotify_mark *mark) | |||
67 | 67 | ||
68 | spin_lock(&inode->i_lock); | 68 | spin_lock(&inode->i_lock); |
69 | 69 | ||
70 | hlist_del_init(&mark->i.i_list); | 70 | hlist_del_init_rcu(&mark->i.i_list); |
71 | mark->i.inode = NULL; | 71 | mark->i.inode = NULL; |
72 | 72 | ||
73 | /* | 73 | /* |
@@ -92,7 +92,7 @@ void fsnotify_clear_marks_by_inode(struct inode *inode) | |||
92 | spin_lock(&inode->i_lock); | 92 | spin_lock(&inode->i_lock); |
93 | hlist_for_each_entry_safe(mark, pos, n, &inode->i_fsnotify_marks, i.i_list) { | 93 | hlist_for_each_entry_safe(mark, pos, n, &inode->i_fsnotify_marks, i.i_list) { |
94 | list_add(&mark->i.free_i_list, &free_list); | 94 | list_add(&mark->i.free_i_list, &free_list); |
95 | hlist_del_init(&mark->i.i_list); | 95 | hlist_del_init_rcu(&mark->i.i_list); |
96 | fsnotify_get_mark(mark); | 96 | fsnotify_get_mark(mark); |
97 | } | 97 | } |
98 | spin_unlock(&inode->i_lock); | 98 | spin_unlock(&inode->i_lock); |
@@ -198,7 +198,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark, | |||
198 | 198 | ||
199 | /* is mark the first mark? */ | 199 | /* is mark the first mark? */ |
200 | if (hlist_empty(&inode->i_fsnotify_marks)) { | 200 | if (hlist_empty(&inode->i_fsnotify_marks)) { |
201 | hlist_add_head(&mark->i.i_list, &inode->i_fsnotify_marks); | 201 | hlist_add_head_rcu(&mark->i.i_list, &inode->i_fsnotify_marks); |
202 | goto out; | 202 | goto out; |
203 | } | 203 | } |
204 | 204 | ||
@@ -214,13 +214,13 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark, | |||
214 | if (mark->group < lmark->group) | 214 | if (mark->group < lmark->group) |
215 | continue; | 215 | continue; |
216 | 216 | ||
217 | hlist_add_before(&mark->i.i_list, &lmark->i.i_list); | 217 | hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list); |
218 | goto out; | 218 | goto out; |
219 | } | 219 | } |
220 | 220 | ||
221 | BUG_ON(last == NULL); | 221 | BUG_ON(last == NULL); |
222 | /* mark should be the last entry. last is the current last entry */ | 222 | /* mark should be the last entry. last is the current last entry */ |
223 | hlist_add_after(last, &mark->i.i_list); | 223 | hlist_add_after_rcu(last, &mark->i.i_list); |
224 | out: | 224 | out: |
225 | fsnotify_recalc_inode_mask_locked(inode); | 225 | fsnotify_recalc_inode_mask_locked(inode); |
226 | spin_unlock(&inode->i_lock); | 226 | spin_unlock(&inode->i_lock); |
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c index c4b3f14d2530..b7ae64030021 100644 --- a/fs/notify/vfsmount_mark.c +++ b/fs/notify/vfsmount_mark.c | |||
@@ -39,7 +39,7 @@ void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) | |||
39 | spin_lock(&mnt->mnt_root->d_lock); | 39 | spin_lock(&mnt->mnt_root->d_lock); |
40 | hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) { | 40 | hlist_for_each_entry_safe(mark, pos, n, &mnt->mnt_fsnotify_marks, m.m_list) { |
41 | list_add(&mark->m.free_m_list, &free_list); | 41 | list_add(&mark->m.free_m_list, &free_list); |
42 | hlist_del_init(&mark->m.m_list); | 42 | hlist_del_init_rcu(&mark->m.m_list); |
43 | fsnotify_get_mark(mark); | 43 | fsnotify_get_mark(mark); |
44 | } | 44 | } |
45 | spin_unlock(&mnt->mnt_root->d_lock); | 45 | spin_unlock(&mnt->mnt_root->d_lock); |
@@ -91,7 +91,7 @@ void fsnotify_destroy_vfsmount_mark(struct fsnotify_mark *mark) | |||
91 | 91 | ||
92 | spin_lock(&mnt->mnt_root->d_lock); | 92 | spin_lock(&mnt->mnt_root->d_lock); |
93 | 93 | ||
94 | hlist_del_init(&mark->m.m_list); | 94 | hlist_del_init_rcu(&mark->m.m_list); |
95 | mark->m.mnt = NULL; | 95 | mark->m.mnt = NULL; |
96 | 96 | ||
97 | fsnotify_recalc_vfsmount_mask_locked(mnt); | 97 | fsnotify_recalc_vfsmount_mask_locked(mnt); |
@@ -156,7 +156,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, | |||
156 | 156 | ||
157 | /* is mark the first mark? */ | 157 | /* is mark the first mark? */ |
158 | if (hlist_empty(&mnt->mnt_fsnotify_marks)) { | 158 | if (hlist_empty(&mnt->mnt_fsnotify_marks)) { |
159 | hlist_add_head(&mark->m.m_list, &mnt->mnt_fsnotify_marks); | 159 | hlist_add_head_rcu(&mark->m.m_list, &mnt->mnt_fsnotify_marks); |
160 | goto out; | 160 | goto out; |
161 | } | 161 | } |
162 | 162 | ||
@@ -172,13 +172,13 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, | |||
172 | if (mark->group < lmark->group) | 172 | if (mark->group < lmark->group) |
173 | continue; | 173 | continue; |
174 | 174 | ||
175 | hlist_add_before(&mark->m.m_list, &lmark->m.m_list); | 175 | hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list); |
176 | goto out; | 176 | goto out; |
177 | } | 177 | } |
178 | 178 | ||
179 | BUG_ON(last == NULL); | 179 | BUG_ON(last == NULL); |
180 | /* mark should be the last entry. last is the current last entry */ | 180 | /* mark should be the last entry. last is the current last entry */ |
181 | hlist_add_after(last, &mark->m.m_list); | 181 | hlist_add_after_rcu(last, &mark->m.m_list); |
182 | out: | 182 | out: |
183 | fsnotify_recalc_vfsmount_mask_locked(mnt); | 183 | fsnotify_recalc_vfsmount_mask_locked(mnt); |
184 | spin_unlock(&mnt->mnt_root->d_lock); | 184 | spin_unlock(&mnt->mnt_root->d_lock); |