aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 10:18:38 -0400
committerEric Paris <eparis@redhat.com>2010-07-28 10:18:53 -0400
commit0215054f377ce5ac4ffc27b26b13b3f10e6410e6 (patch)
treea736317ce8ad2aa1d272a482179f8c0ddc062ae7
parent4cd76a47924cd966799402d0f2bba356cde5c1b3 (diff)
fanotify: use the mark in handler functions
fanotify now gets a mark in the should_send_event and handle_event functions. Rather than look up the mark themselves fanotify should just use the mark it was handed. Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/notify/fanotify/fanotify.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index abfba45abe2c..666ccb733066 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -152,18 +152,16 @@ static int fanotify_handle_event(struct fsnotify_group *group,
152 return ret; 152 return ret;
153} 153}
154 154
155static bool should_send_vfsmount_event(struct fsnotify_group *group, struct vfsmount *mnt, 155static bool should_send_vfsmount_event(struct fsnotify_group *group,
156 struct inode *inode, __u32 mask) 156 struct vfsmount *mnt,
157 struct inode *inode,
158 struct fsnotify_mark *mnt_mark,
159 __u32 mask)
157{ 160{
158 struct fsnotify_mark *mnt_mark;
159 struct fsnotify_mark *inode_mark; 161 struct fsnotify_mark *inode_mark;
160 162
161 pr_debug("%s: group=%p vfsmount=%p mask=%x\n", 163 pr_debug("%s: group=%p vfsmount=%p mark=%p mask=%x\n",
162 __func__, group, mnt, mask); 164 __func__, group, mnt, mnt_mark, mask);
163
164 mnt_mark = fsnotify_find_vfsmount_mark(group, mnt);
165 if (!mnt_mark)
166 return false;
167 165
168 mask &= mnt_mark->mask; 166 mask &= mnt_mark->mask;
169 mask &= ~mnt_mark->ignored_mask; 167 mask &= ~mnt_mark->ignored_mask;
@@ -176,28 +174,21 @@ static bool should_send_vfsmount_event(struct fsnotify_group *group, struct vfsm
176 } 174 }
177 } 175 }
178 176
179 /* find took a reference */
180 fsnotify_put_mark(mnt_mark);
181
182 return mask; 177 return mask;
183} 178}
184 179
185static bool should_send_inode_event(struct fsnotify_group *group, struct inode *inode, 180static bool should_send_inode_event(struct fsnotify_group *group,
181 struct inode *inode,
182 struct fsnotify_mark *mark,
186 __u32 mask) 183 __u32 mask)
187{ 184{
188 struct fsnotify_mark *fsn_mark; 185 pr_debug("%s: group=%p inode=%p mark=%p mask=%x\n",
189 186 __func__, group, inode, mark, mask);
190 pr_debug("%s: group=%p inode=%p mask=%x\n",
191 __func__, group, inode, mask);
192
193 fsn_mark = fsnotify_find_inode_mark(group, inode);
194 if (!fsn_mark)
195 return false;
196 187
197 /* if the event is for a child and this inode doesn't care about 188 /* if the event is for a child and this inode doesn't care about
198 * events on the child, don't send it! */ 189 * events on the child, don't send it! */
199 if ((mask & FS_EVENT_ON_CHILD) && 190 if ((mask & FS_EVENT_ON_CHILD) &&
200 !(fsn_mark->mask & FS_EVENT_ON_CHILD)) { 191 !(mark->mask & FS_EVENT_ON_CHILD)) {
201 mask = 0; 192 mask = 0;
202 } else { 193 } else {
203 /* 194 /*
@@ -205,13 +196,10 @@ static bool should_send_inode_event(struct fsnotify_group *group, struct inode *
205 * type of event? 196 * type of event?
206 */ 197 */
207 mask &= ~FS_EVENT_ON_CHILD; 198 mask &= ~FS_EVENT_ON_CHILD;
208 mask &= fsn_mark->mask; 199 mask &= mark->mask;
209 mask &= ~fsn_mark->ignored_mask; 200 mask &= ~mark->ignored_mask;
210 } 201 }
211 202
212 /* find took a reference */
213 fsnotify_put_mark(fsn_mark);
214
215 return mask; 203 return mask;
216} 204}
217 205
@@ -232,9 +220,9 @@ static bool fanotify_should_send_event(struct fsnotify_group *group, struct inod
232 return false; 220 return false;
233 221
234 if (mnt) 222 if (mnt)
235 return should_send_vfsmount_event(group, mnt, to_tell, mask); 223 return should_send_vfsmount_event(group, mnt, to_tell, mark, mask);
236 else 224 else
237 return should_send_inode_event(group, to_tell, mask); 225 return should_send_inode_event(group, to_tell, mark, mask);
238} 226}
239 227
240const struct fsnotify_ops fanotify_fsnotify_ops = { 228const struct fsnotify_ops fanotify_fsnotify_ops = {