@@ -3,6 +3,7 @@
#include <linux/list.h>
#include <linux/fsnotify.h>
+#include <linux/fsnotify_head.h>
#include <linux/srcu.h>
#include <linux/types.h>
@@ -12,8 +13,8 @@ extern void fsnotify_flush_notify(struct
/* protects reads of inode and vfsmount marks list */
extern struct srcu_struct fsnotify_mark_srcu;
-/* Calculate mask of events for a list of marks */
-extern u32 fsnotify_recalc_mask(struct hlist_head *head);
+/* Recalculate the fsnotify_head's mask from its marks */
+extern void fsnotify_recalc_mask(struct fsnotify_head *fsn);
/* compare two groups for sorting of marks lists */
extern int fsnotify_compare_groups(struct fsnotify_group *a,
@@ -37,7 +37,7 @@
void fsnotify_recalc_inode_mask(struct inode *inode)
{
spin_lock(&inode->i_lock);
- inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+ fsnotify_recalc_mask(&inode->i_fsnotify);
spin_unlock(&inode->i_lock);
__fsnotify_update_child_dentry_flags(inode);
@@ -60,7 +60,7 @@ void fsnotify_destroy_inode_mark(struct
* hold the inode->i_lock, so this is the perfect time to update the
* inode->i_fsnotify.mask
*/
- inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+ fsnotify_recalc_mask(&inode->i_fsnotify);
spin_unlock(&inode->i_lock);
}
@@ -155,7 +155,7 @@ int fsnotify_add_inode_mark(struct fsnot
mark->inode = inode;
ret = fsnotify_add_mark_list(&inode->i_fsnotify.marks, mark,
allow_dups);
- inode->i_fsnotify.mask = fsnotify_recalc_mask(&inode->i_fsnotify.marks);
+ fsnotify_recalc_mask(&inode->i_fsnotify);
spin_unlock(&inode->i_lock);
return ret;
@@ -89,6 +89,7 @@
#include <linux/atomic.h>
#include <linux/fsnotify_backend.h>
+#include <linux/fsnotify_head.h>
#include "fsnotify.h"
struct srcu_struct fsnotify_mark_srcu;
@@ -111,14 +112,15 @@ void fsnotify_put_mark(struct fsnotify_m
}
/* Calculate mask of events for a list of marks */
-u32 fsnotify_recalc_mask(struct hlist_head *head)
+void fsnotify_recalc_mask(struct fsnotify_head *fsn)
{
u32 new_mask = 0;
struct fsnotify_mark *mark;
- hlist_for_each_entry(mark, head, obj_list)
+ hlist_for_each_entry(mark, &fsn->marks, obj_list)
new_mask |= mark->mask;
- return new_mask;
+
+ fsn->mask = new_mask;
}
/*
@@ -62,7 +62,7 @@ void fsnotify_recalc_vfsmount_mask(struc
struct mount *m = real_mount(mnt);
spin_lock(&mnt->mnt_root->d_lock);
- m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+ fsnotify_recalc_mask(&m->mnt_fsnotify);
spin_unlock(&mnt->mnt_root->d_lock);
}
@@ -79,7 +79,7 @@ void fsnotify_destroy_vfsmount_mark(stru
hlist_del_init_rcu(&mark->obj_list);
mark->mnt = NULL;
- m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+ fsnotify_recalc_mask(&m->mnt_fsnotify);
spin_unlock(&mnt->mnt_root->d_lock);
}
@@ -120,7 +120,7 @@ int fsnotify_add_vfsmount_mark(struct fs
spin_lock(&mnt->mnt_root->d_lock);
mark->mnt = mnt;
ret = fsnotify_add_mark_list(&m->mnt_fsnotify.marks, mark, allow_dups);
- m->mnt_fsnotify.mask = fsnotify_recalc_mask(&m->mnt_fsnotify.marks);
+ fsnotify_recalc_mask(&m->mnt_fsnotify);
spin_unlock(&mnt->mnt_root->d_lock);
return ret;