]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
fsnotify: remove the global masks
authorEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 14:18:39 +0000 (10:18 -0400)
committerEric Paris <eparis@redhat.com>
Wed, 28 Jul 2010 14:18:54 +0000 (10:18 -0400)
Because we walk the object->fsnotify_marks list instead of the global
fsnotify groups list we don't need the fsnotify_inode_mask and
fsnotify_vfsmount_mask as these were simply shortcuts in fsnotify() for
performance.  They are now extra checks, rip them out.

Signed-off-by: Eric Paris <eparis@redhat.com>
fs/notify/fsnotify.c
fs/notify/fsnotify.h
fs/notify/group.c
include/linux/fsnotify_backend.h

index 53b31f46d698c9d000437ced9fa8db342a041105..9ba29ee747cf267b6591d6fb13756b9dd582b084 100644 (file)
@@ -227,11 +227,6 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is,
        if (mask & FS_MODIFY)
                __fsnotify_flush_ignored_mask(to_tell, data, data_is);
 
-       /* if none of the directed listeners or vfsmount listeners care */
-       if (!(test_mask & fsnotify_inode_mask) &&
-           !(test_mask & fsnotify_vfsmount_mask))
-               return 0;
        if (data_is == FSNOTIFY_EVENT_FILE)
                mnt = ((struct file *)data)->f_path.mnt;
 
index 7eed86f942ba2707abec31e99691147cc80d5cd3..b41dbf5a125c388825335390feec6c5189999bad 100644 (file)
 extern struct list_head fsnotify_inode_groups;
 /* all groups which receive vfsmount fsnotify events */
 extern struct list_head fsnotify_vfsmount_groups;
-/* all bitwise OR of all event types (FS_*) for all fsnotify_inode_groups */
-extern __u32 fsnotify_inode_mask;
-/* all bitwise OR of all event types (FS_*) for all fsnotify_vfsmount_groups */
-extern __u32 fsnotify_vfsmount_mask;
 
 /* destroy all events sitting in this groups notification queue */
 extern void fsnotify_flush_notify(struct fsnotify_group *group);
index 48d3a6d6e47aec40f1e5aac480550d7105b8e8d1..8da532dd602635b9454061a70f53f71ff94ebce5 100644 (file)
@@ -34,54 +34,21 @@ static DEFINE_MUTEX(fsnotify_grp_mutex);
 LIST_HEAD(fsnotify_inode_groups);
 /* all groups registered to receive mount point filesystem notifications */
 LIST_HEAD(fsnotify_vfsmount_groups);
-/* bitwise OR of all events (FS_*) interesting to some group on this system */
-__u32 fsnotify_inode_mask;
-/* bitwise OR of all events (FS_*) interesting to some group on this system */
-__u32 fsnotify_vfsmount_mask;
-
-/*
- * When a new group registers or changes it's set of interesting events
- * this function updates the fsnotify_mask to contain all interesting events
- */
-void fsnotify_recalc_global_mask(void)
-{
-       struct fsnotify_group *group;
-       __u32 inode_mask = 0;
-       __u32 vfsmount_mask = 0;
-
-       mutex_lock(&fsnotify_grp_mutex);
-       list_for_each_entry_rcu(group, &fsnotify_inode_groups, inode_group_list)
-               inode_mask |= group->mask;
-       list_for_each_entry_rcu(group, &fsnotify_vfsmount_groups, vfsmount_group_list)
-               vfsmount_mask |= group->mask;
-
-       fsnotify_inode_mask = inode_mask;
-       fsnotify_vfsmount_mask = vfsmount_mask;
-
-       mutex_unlock(&fsnotify_grp_mutex);
-}
 
 /*
  * Update the group->mask by running all of the marks associated with this
- * group and finding the bitwise | of all of the mark->mask.  If we change
- * the group->mask we need to update the global mask of events interesting
- * to the system.
+ * group and finding the bitwise | of all of the mark->mask.
  */
 void fsnotify_recalc_group_mask(struct fsnotify_group *group)
 {
        __u32 mask = 0;
-       __u32 old_mask = group->mask;
        struct fsnotify_mark *mark;
 
        spin_lock(&group->mark_lock);
        list_for_each_entry(mark, &group->marks_list, g_list)
                mask |= mark->mask;
-       spin_unlock(&group->mark_lock);
-
        group->mask = mask;
-
-       if (old_mask != mask)
-               fsnotify_recalc_global_mask();
+       spin_unlock(&group->mark_lock);
 }
 
 void fsnotify_add_vfsmount_group(struct fsnotify_group *group)
@@ -217,8 +184,6 @@ void fsnotify_put_group(struct fsnotify_group *group)
 
        mutex_unlock(&fsnotify_grp_mutex);
 
-       /* and now it is really dead. _Nothing_ could be seeing it */
-       fsnotify_recalc_global_mask();
        fsnotify_destroy_group(group);
 }
 
index 225dc0c3a48cccb5b2e4cafb2c3887f57a8deac6..07d3c895472159c314f501b06f8eef06ba589e1f 100644 (file)
@@ -365,8 +365,6 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode
 
 /* called from fsnotify listeners, such as fanotify or dnotify */
 
-/* must call when a group changes its ->mask */
-extern void fsnotify_recalc_global_mask(void);
 /* get a reference to an existing or create a new group */
 extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops);
 /* run all marks associated with this group and update group->mask */