aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-12-21 10:03:59 -0500
committerJan Kara <jack@suse.cz>2017-04-10 11:37:36 -0400
commit66d2b81bcb92c14b22a56a9ff936f2b40accc83c (patch)
tree03632d0a65bc71141a6788381a0eea5eb2f4660d
parent05f0e38724e8449184acd8fbf0473ee5a07adc6c (diff)
fsnotify: Remove fsnotify_set_mark_{,ignored_}mask_locked()
These helpers are now only a simple assignment and just obfuscate what is going on. Remove them. Reviewed-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/notify/dnotify/dnotify.c9
-rw-r--r--fs/notify/fanotify/fanotify_user.c9
-rw-r--r--fs/notify/inotify/inotify_user.c6
-rw-r--r--fs/notify/mark.c14
-rw-r--r--include/linux/fsnotify_backend.h4
5 files changed, 9 insertions, 33 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index aba165ae3397..5940c75541a7 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -52,7 +52,7 @@ struct dnotify_mark {
52 */ 52 */
53static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark) 53static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
54{ 54{
55 __u32 new_mask, old_mask; 55 __u32 new_mask = 0;
56 struct dnotify_struct *dn; 56 struct dnotify_struct *dn;
57 struct dnotify_mark *dn_mark = container_of(fsn_mark, 57 struct dnotify_mark *dn_mark = container_of(fsn_mark,
58 struct dnotify_mark, 58 struct dnotify_mark,
@@ -60,14 +60,11 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
60 60
61 assert_spin_locked(&fsn_mark->lock); 61 assert_spin_locked(&fsn_mark->lock);
62 62
63 old_mask = fsn_mark->mask;
64 new_mask = 0;
65 for (dn = dn_mark->dn; dn != NULL; dn = dn->dn_next) 63 for (dn = dn_mark->dn; dn != NULL; dn = dn->dn_next)
66 new_mask |= (dn->dn_mask & ~FS_DN_MULTISHOT); 64 new_mask |= (dn->dn_mask & ~FS_DN_MULTISHOT);
67 fsnotify_set_mark_mask_locked(fsn_mark, new_mask); 65 if (fsn_mark->mask == new_mask)
68
69 if (old_mask == new_mask)
70 return; 66 return;
67 fsn_mark->mask = new_mask;
71 68
72 fsnotify_recalc_mask(fsn_mark->connector); 69 fsnotify_recalc_mask(fsn_mark->connector);
73} 70}
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index c5e69870287f..cf38a345032f 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -511,13 +511,12 @@ static __u32 fanotify_mark_remove_from_mask(struct fsnotify_mark *fsn_mark,
511 tmask &= ~FAN_ONDIR; 511 tmask &= ~FAN_ONDIR;
512 512
513 oldmask = fsn_mark->mask; 513 oldmask = fsn_mark->mask;
514 fsnotify_set_mark_mask_locked(fsn_mark, tmask); 514 fsn_mark->mask = tmask;
515 } else { 515 } else {
516 __u32 tmask = fsn_mark->ignored_mask & ~mask; 516 __u32 tmask = fsn_mark->ignored_mask & ~mask;
517 if (flags & FAN_MARK_ONDIR) 517 if (flags & FAN_MARK_ONDIR)
518 tmask &= ~FAN_ONDIR; 518 tmask &= ~FAN_ONDIR;
519 519 fsn_mark->ignored_mask = tmask;
520 fsnotify_set_mark_ignored_mask_locked(fsn_mark, tmask);
521 } 520 }
522 *destroy = !(fsn_mark->mask | fsn_mark->ignored_mask); 521 *destroy = !(fsn_mark->mask | fsn_mark->ignored_mask);
523 spin_unlock(&fsn_mark->lock); 522 spin_unlock(&fsn_mark->lock);
@@ -599,13 +598,13 @@ static __u32 fanotify_mark_add_to_mask(struct fsnotify_mark *fsn_mark,
599 tmask |= FAN_ONDIR; 598 tmask |= FAN_ONDIR;
600 599
601 oldmask = fsn_mark->mask; 600 oldmask = fsn_mark->mask;
602 fsnotify_set_mark_mask_locked(fsn_mark, tmask); 601 fsn_mark->mask = tmask;
603 } else { 602 } else {
604 __u32 tmask = fsn_mark->ignored_mask | mask; 603 __u32 tmask = fsn_mark->ignored_mask | mask;
605 if (flags & FAN_MARK_ONDIR) 604 if (flags & FAN_MARK_ONDIR)
606 tmask |= FAN_ONDIR; 605 tmask |= FAN_ONDIR;
607 606
608 fsnotify_set_mark_ignored_mask_locked(fsn_mark, tmask); 607 fsn_mark->ignored_mask = tmask;
609 if (flags & FAN_MARK_IGNORED_SURV_MODIFY) 608 if (flags & FAN_MARK_IGNORED_SURV_MODIFY)
610 fsn_mark->flags |= FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY; 609 fsn_mark->flags |= FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY;
611 } 610 }
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 05b268ec0f5f..69739b26c7e4 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -513,14 +513,12 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
513 i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark); 513 i_mark = container_of(fsn_mark, struct inotify_inode_mark, fsn_mark);
514 514
515 spin_lock(&fsn_mark->lock); 515 spin_lock(&fsn_mark->lock);
516
517 old_mask = fsn_mark->mask; 516 old_mask = fsn_mark->mask;
518 if (add) 517 if (add)
519 fsnotify_set_mark_mask_locked(fsn_mark, (fsn_mark->mask | mask)); 518 fsn_mark->mask |= mask;
520 else 519 else
521 fsnotify_set_mark_mask_locked(fsn_mark, mask); 520 fsn_mark->mask = mask;
522 new_mask = fsn_mark->mask; 521 new_mask = fsn_mark->mask;
523
524 spin_unlock(&fsn_mark->lock); 522 spin_unlock(&fsn_mark->lock);
525 523
526 if (old_mask != new_mask) { 524 if (old_mask != new_mask) {
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index c4f43a6acd9a..ae33e9f91849 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -393,20 +393,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark,
393 fsnotify_free_mark(mark); 393 fsnotify_free_mark(mark);
394} 394}
395 395
396void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask)
397{
398 assert_spin_locked(&mark->lock);
399
400 mark->mask = mask;
401}
402
403void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask)
404{
405 assert_spin_locked(&mark->lock);
406
407 mark->ignored_mask = mask;
408}
409
410/* 396/*
411 * Sorting function for lists of fsnotify marks. 397 * Sorting function for lists of fsnotify marks.
412 * 398 *
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 744a4b9076f9..63354cd86a7b 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -347,10 +347,6 @@ extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(str
347extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode); 347extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode);
348/* find (and take a reference) to a mark associated with group and vfsmount */ 348/* find (and take a reference) to a mark associated with group and vfsmount */
349extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt); 349extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt);
350/* set the ignored_mask of a mark */
351extern void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask);
352/* set the mask of a mark (might pin the object into memory */
353extern void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask);
354/* attach the mark to both the group and the inode */ 350/* attach the mark to both the group and the inode */
355extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, 351extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
356 struct inode *inode, struct vfsmount *mnt, int allow_dups); 352 struct inode *inode, struct vfsmount *mnt, int allow_dups);