Commit 43709a288ed03aa0e2979ab63dd089b3889645c4
1 parent
03930979af
Exists in
master
and in
4 other branches
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>
Showing 6 changed files with 5 additions and 66 deletions Side-by-side Diff
fs/notify/dnotify/dnotify.c
... | ... | @@ -199,8 +199,6 @@ |
199 | 199 | if (dn_mark->dn == NULL) |
200 | 200 | fsnotify_destroy_mark(fsn_mark); |
201 | 201 | |
202 | - fsnotify_recalc_group_mask(dnotify_group); | |
203 | - | |
204 | 202 | mutex_unlock(&dnotify_mark_mutex); |
205 | 203 | |
206 | 204 | fsnotify_put_mark(fsn_mark); |
... | ... | @@ -384,8 +382,6 @@ |
384 | 382 | |
385 | 383 | if (destroy) |
386 | 384 | fsnotify_destroy_mark(fsn_mark); |
387 | - | |
388 | - fsnotify_recalc_group_mask(dnotify_group); | |
389 | 385 | |
390 | 386 | mutex_unlock(&dnotify_mark_mutex); |
391 | 387 | fsnotify_put_mark(fsn_mark); |
fs/notify/fanotify/fanotify_user.c
... | ... | @@ -496,8 +496,6 @@ |
496 | 496 | |
497 | 497 | removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); |
498 | 498 | fsnotify_put_mark(fsn_mark); |
499 | - if (removed & group->mask) | |
500 | - fsnotify_recalc_group_mask(group); | |
501 | 499 | if (removed & mnt->mnt_fsnotify_mask) |
502 | 500 | fsnotify_recalc_vfsmount_mask(mnt); |
503 | 501 | |
... | ... | @@ -518,9 +516,6 @@ |
518 | 516 | removed = fanotify_mark_remove_from_mask(fsn_mark, mask, flags); |
519 | 517 | /* matches the fsnotify_find_inode_mark() */ |
520 | 518 | fsnotify_put_mark(fsn_mark); |
521 | - | |
522 | - if (removed & group->mask) | |
523 | - fsnotify_recalc_group_mask(group); | |
524 | 519 | if (removed & inode->i_fsnotify_mask) |
525 | 520 | fsnotify_recalc_inode_mask(inode); |
526 | 521 | |
... | ... | @@ -572,12 +567,9 @@ |
572 | 567 | } |
573 | 568 | added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); |
574 | 569 | fsnotify_put_mark(fsn_mark); |
575 | - if (added) { | |
576 | - if (added & ~group->mask) | |
577 | - fsnotify_recalc_group_mask(group); | |
578 | - if (added & ~mnt->mnt_fsnotify_mask) | |
579 | - fsnotify_recalc_vfsmount_mask(mnt); | |
580 | - } | |
570 | + if (added & ~mnt->mnt_fsnotify_mask) | |
571 | + fsnotify_recalc_vfsmount_mask(mnt); | |
572 | + | |
581 | 573 | return 0; |
582 | 574 | } |
583 | 575 | |
... | ... | @@ -607,12 +599,8 @@ |
607 | 599 | } |
608 | 600 | added = fanotify_mark_add_to_mask(fsn_mark, mask, flags); |
609 | 601 | fsnotify_put_mark(fsn_mark); |
610 | - if (added) { | |
611 | - if (added & ~group->mask) | |
612 | - fsnotify_recalc_group_mask(group); | |
613 | - if (added & ~inode->i_fsnotify_mask) | |
614 | - fsnotify_recalc_inode_mask(inode); | |
615 | - } | |
602 | + if (added & ~inode->i_fsnotify_mask) | |
603 | + fsnotify_recalc_inode_mask(inode); | |
616 | 604 | return 0; |
617 | 605 | } |
618 | 606 | |
... | ... | @@ -734,7 +722,6 @@ |
734 | 722 | fsnotify_clear_vfsmount_marks_by_group(group); |
735 | 723 | else |
736 | 724 | fsnotify_clear_inode_marks_by_group(group); |
737 | - fsnotify_recalc_group_mask(group); | |
738 | 725 | break; |
739 | 726 | default: |
740 | 727 | ret = -EINVAL; |
fs/notify/group.c
... | ... | @@ -35,22 +35,6 @@ |
35 | 35 | /* all groups registered to receive mount point filesystem notifications */ |
36 | 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 | 38 | void fsnotify_add_vfsmount_group(struct fsnotify_group *group) |
55 | 39 | { |
56 | 40 | struct fsnotify_group *group_iter; |
fs/notify/inotify/inotify_user.c
... | ... | @@ -606,16 +606,11 @@ |
606 | 606 | int dropped = (old_mask & ~new_mask); |
607 | 607 | /* more bits in this fsn_mark than the inode's mask? */ |
608 | 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 | 610 | /* update the inode with this new fsn_mark */ |
613 | 611 | if (dropped || do_inode) |
614 | 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 | 616 | /* return the wd */ |
... | ... | @@ -672,10 +667,6 @@ |
672 | 667 | |
673 | 668 | /* return the watch descriptor for this new mark */ |
674 | 669 | ret = tmp_i_mark->wd; |
675 | - | |
676 | - /* if this mark added a new event update the group mask */ | |
677 | - if (mask & ~group->mask) | |
678 | - fsnotify_recalc_group_mask(group); | |
679 | 670 | |
680 | 671 | out_err: |
681 | 672 | /* match the ref from fsnotify_init_mark() */ |
include/linux/fsnotify_backend.h
... | ... | @@ -120,15 +120,6 @@ |
120 | 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 | 123 | * How the refcnt is used is up to each group. When the refcnt hits 0 |
133 | 124 | * fsnotify will clean up all of the resources associated with this group. |
134 | 125 | * As an example, the dnotify group will always have a refcnt=1 and that |
... | ... | @@ -367,8 +358,6 @@ |
367 | 358 | |
368 | 359 | /* get a reference to an existing or create a new group */ |
369 | 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 | 361 | /* drop reference on a group from fsnotify_alloc_group */ |
373 | 362 | extern void fsnotify_put_group(struct fsnotify_group *group); |
374 | 363 |
kernel/audit_watch.c
... | ... | @@ -164,8 +164,6 @@ |
164 | 164 | return ERR_PTR(ret); |
165 | 165 | } |
166 | 166 | |
167 | - fsnotify_recalc_group_mask(audit_watch_group); | |
168 | - | |
169 | 167 | return parent; |
170 | 168 | } |
171 | 169 | |
... | ... | @@ -352,9 +350,6 @@ |
352 | 350 | mutex_unlock(&audit_filter_mutex); |
353 | 351 | |
354 | 352 | fsnotify_destroy_mark(&parent->mark); |
355 | - | |
356 | - fsnotify_recalc_group_mask(audit_watch_group); | |
357 | - | |
358 | 353 | } |
359 | 354 | |
360 | 355 | /* Get path information necessary for adding watches. */ |
... | ... | @@ -505,9 +500,6 @@ |
505 | 500 | audit_put_parent(parent); |
506 | 501 | } |
507 | 502 | } |
508 | - | |
509 | - fsnotify_recalc_group_mask(audit_watch_group); | |
510 | - | |
511 | 503 | } |
512 | 504 | |
513 | 505 | static bool audit_watch_should_send_event(struct fsnotify_group *group, struct inode *inode, |