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 /fs/notify | |
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>
Diffstat (limited to 'fs/notify')
-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 |
4 files changed, 5 insertions, 47 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); |