summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 18:18:39 +0400
committerEric Paris <eparis@redhat.com>2010-07-28 18:18:53 +0400
commit2612abb51b11ffd2d75c472b11178115f5808909 (patch)
tree5657a07a347984cc1f34117d7ef88af73ea12b60
parent0215054f377ce5ac4ffc27b26b13b3f10e6410e6 (diff)
downloadlinux-2612abb51b11ffd2d75c472b11178115f5808909.tar.xz
fsnotify: cleanup should_send_event
The change to use srcu and walk the object list rather than the global fsnotify_group list means that should_send_event is no longer needed for a number of groups and can be simplified for others. Do that. Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/notify/dnotify/dnotify.c11
-rw-r--r--fs/notify/fanotify/fanotify.c23
-rw-r--r--fs/notify/fsnotify.c4
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c14
-rw-r--r--kernel/audit_tree.c2
-rw-r--r--kernel/audit_watch.c7
6 files changed, 16 insertions, 45 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index e3e855ff0dd8..c3dc15879a52 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -129,20 +129,11 @@ static bool dnotify_should_send_event(struct fsnotify_group *group,
struct fsnotify_mark *mark, __u32 mask,
void *data, int data_type)
{
- bool send;
-
- /* !dir_notify_enable should never get here, don't waste time checking
- if (!dir_notify_enable)
- return 0; */
-
/* not a dir, dnotify doesn't care */
if (!S_ISDIR(inode->i_mode))
return false;
- mask = (mask & ~FS_EVENT_ON_CHILD);
- send = (mask & mark->mask);
-
- return send;
+ return true;
}
static void dnotify_free_mark(struct fsnotify_mark *fsn_mark)
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 666ccb733066..fbd7f35c6134 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -185,22 +185,15 @@ static bool should_send_inode_event(struct fsnotify_group *group,
pr_debug("%s: group=%p inode=%p mark=%p mask=%x\n",
__func__, group, inode, mark, mask);
- /* if the event is for a child and this inode doesn't care about
- * events on the child, don't send it! */
+ /*
+ * if the event is for a child and this inode doesn't care about
+ * events on the child, don't send it!
+ */
if ((mask & FS_EVENT_ON_CHILD) &&
- !(mark->mask & FS_EVENT_ON_CHILD)) {
- mask = 0;
- } else {
- /*
- * We care about children, but do we care about this particular
- * type of event?
- */
- mask &= ~FS_EVENT_ON_CHILD;
- mask &= mark->mask;
- mask &= ~mark->ignored_mask;
- }
-
- return mask;
+ !(mark->mask & FS_EVENT_ON_CHILD))
+ return false;
+ else
+ return true;
}
static bool fanotify_should_send_event(struct fsnotify_group *group, struct inode *to_tell,
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 59d639996cad..53b31f46d698 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -180,8 +180,8 @@ static int send_to_group(struct fsnotify_group *group, struct inode *to_tell,
" data_is=%d cookie=%d event=%p\n", __func__, group, to_tell,
mnt, mark, mask, data, data_is, cookie, *event);
- if (!group->ops->should_send_event(group, to_tell, mnt, mark, mask,
- data, data_is))
+ if (group->ops->should_send_event(group, to_tell, mnt, mark, mask,
+ data, data_is) == false)
return 0;
if (!*event) {
*event = fsnotify_create_event(to_tell, mask, data,
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index aa3f93c03e0f..7cf518b25daa 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -142,23 +142,15 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
struct vfsmount *mnt, struct fsnotify_mark *mark,
__u32 mask, void *data, int data_type)
{
- bool send;
-
- pr_debug("%s: group=%p inode=%p mask=%x data=%p data_type=%d\n",
- __func__, group, inode, mask, data, data_type);
-
- mask = (mask & ~FS_EVENT_ON_CHILD);
- send = (mark->mask & mask);
-
- if (send && (mark->mask & FS_EXCL_UNLINK) &&
+ if ((mark->mask & FS_EXCL_UNLINK) &&
(data_type == FSNOTIFY_EVENT_FILE)) {
struct file *file = data;
if (d_unlinked(file->f_path.dentry))
- send = false;
+ return false;
}
- return send;
+ return true;
}
/*
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 584b94360217..2abb99f3459d 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -923,7 +923,7 @@ static bool audit_tree_send_event(struct fsnotify_group *group, struct inode *in
struct vfsmount *mnt, struct fsnotify_mark *mark,
__u32 mask, void *data, int data_type)
{
- return 0;
+ return false;
}
static const struct fsnotify_ops audit_tree_ops = {
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 9173bcf33763..097a61c65fe0 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -514,12 +514,7 @@ static bool audit_watch_should_send_event(struct fsnotify_group *group, struct i
struct vfsmount *mnt, struct fsnotify_mark *mark,
__u32 mask, void *data, int data_type)
{
- bool send;
-
- mask = (mask & ~FS_EVENT_ON_CHILD);
- send = (mark->mask & mask);
-
- return send;
+ return true;
}
/* Update watch data in audit rules based on fsnotify events. */