diff options
author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:39 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:54 -0400 |
commit | 43709a288ed03aa0e2979ab63dd089b3889645c4 (patch) | |
tree | 71717ebf944c099af5ab8ea339889665d4b9ef67 | |
parent | 03930979afa63e079e9aefd4d3dd429240711027 (diff) |
fsnotify: remove group->mask
group->mask is now useless. It was originally a shortcut for fsnotify to
save on performance. These checks are now redundant, so we remove them.
Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r-- | fs/notify/dnotify/dnotify.c | 4 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 23 | ||||
-rw-r--r-- | fs/notify/group.c | 16 | ||||
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 9 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 11 | ||||
-rw-r--r-- | kernel/audit_watch.c | 8 |
6 files changed, 5 insertions, 66 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index c3dc15879a52..e92b2c87ae94 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -199,8 +199,6 @@ void dnotify_flush(struct file *filp, fl_owner_t id) | |||
199 | if (dn_mark->dn == NULL) | 199 | if (dn_mark->dn == NULL) |
200 | fsnotify_destroy_mark(fsn_mark); | 200 | fsnotify_destroy_mark(fsn_mark); |
201 | 201 | ||
202 | fsnotify_recalc_group_mask(dnotify_group); | ||
203 | |||
204 | mutex_unlock(&dnotify_mark_mutex); | 202 | mutex_unlock(&dnotify_mark_mutex); |
205 | 203 | ||
206 | fsnotify_put_mark(fsn_mark); | 204 | fsnotify_put_mark(fsn_mark); |
@@ -385,8 +383,6 @@ out: | |||
385 | if (destroy) | 383 | if (destroy) |
386 | fsnotify_destroy_mark(fsn_mark); | 384 | fsnotify_destroy_mark(fsn_mark); |
387 | 385 | ||
388 | fsnotify_recalc_group_mask(dnotify_group); | ||
389 | |||
390 | mutex_unlock(&dnotify_mark_mutex); | 386 | mutex_unlock(&dnotify_mark_mutex); |
391 | fsnotify_put_mark(fsn_mark); | 387 | fsnotify_put_mark(fsn_mark); |
392 | out_err: | 388 | out_err: |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 50cea74bf1c8..25a3b4dfcf61 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -496,8 +496,6 @@ static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group, | |||
496 | 496 | ||
497 | removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); | 497 | removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); |
498 | fsnotify_put_mark(fsn_mark); | 498 | fsnotify_put_mark(fsn_mark); |
499 | if (removed & group->mask) | ||
500 | fsnotify_recalc_group_mask(group); | ||
501 | if (removed & mnt->mnt_fsnotify_mask) | 499 | if (removed & mnt->mnt_fsnotify_mask) |
502 | fsnotify_recalc_vfsmount_mask(mnt); | 500 | fsnotify_recalc_vfsmount_mask(mnt); |
503 | 501 | ||
@@ -518,9 +516,6 @@ static int fanotify_remove_inode_mark(struct fsnotify_group *group, | |||
518 | removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); | 516 | removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); |
519 | /* matches the fsnotify_find_inode_mark() */ | 517 | /* matches the fsnotify_find_inode_mark() */ |
520 | fsnotify_put_mark(fsn_mark); | 518 | fsnotify_put_mark(fsn_mark); |
521 | |||
522 | if (removed & group->mask) | ||
523 | fsnotify_recalc_group_mask(group); | ||
524 | if (removed & inode->i_fsnotify_mask) | 519 | if (removed & inode->i_fsnotify_mask) |
525 | fsnotify_recalc_inode_mask(inode); | 520 | fsnotify_recalc_inode_mask(inode); |
526 | 521 | ||
@@ -572,12 +567,9 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group, | |||
572 | } | 567 | } |
573 | added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); | 568 | added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); |
574 | fsnotify_put_mark(fsn_mark); | 569 | fsnotify_put_mark(fsn_mark); |
575 | if (added) { | 570 | if (added & ~mnt->mnt_fsnotify_mask) |
576 | if (added & ~group->mask) | 571 | fsnotify_recalc_vfsmount_mask(mnt); |
577 | fsnotify_recalc_group_mask(group); | 572 | |
578 | if (added & ~mnt->mnt_fsnotify_mask) | ||
579 | fsnotify_recalc_vfsmount_mask(mnt); | ||
580 | } | ||
581 | return 0; | 573 | return 0; |
582 | } | 574 | } |
583 | 575 | ||
@@ -607,12 +599,8 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group, | |||
607 | } | 599 | } |
608 | added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); | 600 | added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); |
609 | fsnotify_put_mark(fsn_mark); | 601 | fsnotify_put_mark(fsn_mark); |
610 | if (added) { | 602 | if (added & ~inode->i_fsnotify_mask) |
611 | if (added & ~group->mask) | 603 | fsnotify_recalc_inode_mask(inode); |
612 | fsnotify_recalc_group_mask(group); | ||
613 | if (added & ~inode->i_fsnotify_mask) | ||
614 | fsnotify_recalc_inode_mask(inode); | ||
615 | } | ||
616 | return 0; | 604 | return 0; |
617 | } | 605 | } |
618 | 606 | ||
@@ -734,7 +722,6 @@ SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags, | |||
734 | fsnotify_clear_vfsmount_marks_by_group(group); | 722 | fsnotify_clear_vfsmount_marks_by_group(group); |
735 | else | 723 | else |
736 | fsnotify_clear_inode_marks_by_group(group); | 724 | fsnotify_clear_inode_marks_by_group(group); |
737 | fsnotify_recalc_group_mask(group); | ||
738 | break; | 725 | break; |
739 | default: | 726 | default: |
740 | ret = -EINVAL; | 727 | ret = -EINVAL; |
diff --git a/fs/notify/group.c b/fs/notify/group.c index 8da532dd6026..fc0d966b270f 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -35,22 +35,6 @@ LIST_HEAD(fsnotify_inode_groups); | |||
35 | /* all groups registered to receive mount point filesystem notifications */ | 35 | /* all groups registered to receive mount point filesystem notifications */ |
36 | LIST_HEAD(fsnotify_vfsmount_groups); | 36 | LIST_HEAD(fsnotify_vfsmount_groups); |
37 | 37 | ||
38 | /* | ||
39 | * Update the group->mask by running all of the marks associated with this | ||
40 | * group and finding the bitwise | of all of the mark->mask. | ||
41 | */ | ||
42 | void fsnotify_recalc_group_mask(struct fsnotify_group *group) | ||
43 | { | ||
44 | __u32 mask = 0; | ||
45 | struct fsnotify_mark *mark; | ||
46 | |||
47 | spin_lock(&group->mark_lock); | ||
48 | list_for_each_entry(mark, &group->marks_list, g_list) | ||
49 | mask |= mark->mask; | ||
50 | group->mask = mask; | ||
51 | spin_unlock(&group->mark_lock); | ||
52 | } | ||
53 | |||
54 | void fsnotify_add_vfsmount_group(struct fsnotify_group *group) | 38 | void fsnotify_add_vfsmount_group(struct fsnotify_group *group) |
55 | { | 39 | { |
56 | struct fsnotify_group *group_iter; | 40 | struct fsnotify_group *group_iter; |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index a4cd227c4c76..bf7f6d776c31 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -606,16 +606,11 @@ static int inotify_update_existing_watch(struct fsnotify_group *group, | |||
606 | int dropped = (old_mask & ~new_mask); | 606 | int dropped = (old_mask & ~new_mask); |
607 | /* more bits in this fsn_mark than the inode's mask? */ | 607 | /* more bits in this fsn_mark than the inode's mask? */ |
608 | int do_inode = (new_mask & ~inode->i_fsnotify_mask); | 608 | int do_inode = (new_mask & ~inode->i_fsnotify_mask); |
609 | /* more bits in this fsn_mark than the group? */ | ||
610 | int do_group = (new_mask & ~group->mask); | ||
611 | 609 | ||
612 | /* update the inode with this new fsn_mark */ | 610 | /* update the inode with this new fsn_mark */ |
613 | if (dropped || do_inode) | 611 | if (dropped || do_inode) |
614 | fsnotify_recalc_inode_mask(inode); | 612 | fsnotify_recalc_inode_mask(inode); |
615 | 613 | ||
616 | /* update the group mask with the new mask */ | ||
617 | if (dropped || do_group) | ||
618 | fsnotify_recalc_group_mask(group); | ||
619 | } | 614 | } |
620 | 615 | ||
621 | /* return the wd */ | 616 | /* return the wd */ |
@@ -673,10 +668,6 @@ static int inotify_new_watch(struct fsnotify_group *group, | |||
673 | /* return the watch descriptor for this new mark */ | 668 | /* return the watch descriptor for this new mark */ |
674 | ret = tmp_i_mark->wd; | 669 | ret = tmp_i_mark->wd; |
675 | 670 | ||
676 | /* if this mark added a new event update the group mask */ | ||
677 | if (mask & ~group->mask) | ||
678 | fsnotify_recalc_group_mask(group); | ||
679 | |||
680 | out_err: | 671 | out_err: |
681 | /* match the ref from fsnotify_init_mark() */ | 672 | /* match the ref from fsnotify_init_mark() */ |
682 | fsnotify_put_mark(&tmp_i_mark->fsn_mark); | 673 | fsnotify_put_mark(&tmp_i_mark->fsn_mark); |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 07d3c8954721..c4e7aab87461 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -120,15 +120,6 @@ struct fsnotify_group { | |||
120 | struct list_head vfsmount_group_list; | 120 | struct list_head vfsmount_group_list; |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Defines all of the event types in which this group is interested. | ||
124 | * This mask is a bitwise OR of the FS_* events from above. Each time | ||
125 | * this mask changes for a group (if it changes) the correct functions | ||
126 | * must be called to update the global structures which indicate global | ||
127 | * interest in event types. | ||
128 | */ | ||
129 | __u32 mask; | ||
130 | |||
131 | /* | ||
132 | * How the refcnt is used is up to each group. When the refcnt hits 0 | 123 | * How the refcnt is used is up to each group. When the refcnt hits 0 |
133 | * fsnotify will clean up all of the resources associated with this group. | 124 | * fsnotify will clean up all of the resources associated with this group. |
134 | * As an example, the dnotify group will always have a refcnt=1 and that | 125 | * As an example, the dnotify group will always have a refcnt=1 and that |
@@ -367,8 +358,6 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode | |||
367 | 358 | ||
368 | /* get a reference to an existing or create a new group */ | 359 | /* get a reference to an existing or create a new group */ |
369 | extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops); | 360 | extern struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops); |
370 | /* run all marks associated with this group and update group->mask */ | ||
371 | extern void fsnotify_recalc_group_mask(struct fsnotify_group *group); | ||
372 | /* drop reference on a group from fsnotify_alloc_group */ | 361 | /* drop reference on a group from fsnotify_alloc_group */ |
373 | extern void fsnotify_put_group(struct fsnotify_group *group); | 362 | extern void fsnotify_put_group(struct fsnotify_group *group); |
374 | 363 | ||
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index 097a61c65fe0..1b87e757845d 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -164,8 +164,6 @@ static struct audit_parent *audit_init_parent(struct nameidata *ndp) | |||
164 | return ERR_PTR(ret); | 164 | return ERR_PTR(ret); |
165 | } | 165 | } |
166 | 166 | ||
167 | fsnotify_recalc_group_mask(audit_watch_group); | ||
168 | |||
169 | return parent; | 167 | return parent; |
170 | } | 168 | } |
171 | 169 | ||
@@ -352,9 +350,6 @@ static void audit_remove_parent_watches(struct audit_parent *parent) | |||
352 | mutex_unlock(&audit_filter_mutex); | 350 | mutex_unlock(&audit_filter_mutex); |
353 | 351 | ||
354 | fsnotify_destroy_mark(&parent->mark); | 352 | fsnotify_destroy_mark(&parent->mark); |
355 | |||
356 | fsnotify_recalc_group_mask(audit_watch_group); | ||
357 | |||
358 | } | 353 | } |
359 | 354 | ||
360 | /* Get path information necessary for adding watches. */ | 355 | /* Get path information necessary for adding watches. */ |
@@ -505,9 +500,6 @@ void audit_remove_watch_rule(struct audit_krule *krule) | |||
505 | audit_put_parent(parent); | 500 | audit_put_parent(parent); |
506 | } | 501 | } |
507 | } | 502 | } |
508 | |||
509 | fsnotify_recalc_group_mask(audit_watch_group); | ||
510 | |||
511 | } | 503 | } |
512 | 504 | ||
513 | static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode, | 505 | static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode, |