diff options
author | Jan Kara <jack@suse.cz> | 2017-03-15 04:41:15 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-04-10 11:37:35 -0400 |
commit | a03e2e4f078365428bb4317989cb5d1d6563cfe9 (patch) | |
tree | daa8ada03fa6b829a06482cbda65ffd0da044421 /fs/notify | |
parent | f06fd98759451876f51607f60abd74c89b141610 (diff) |
fsnotify: Determine lock in fsnotify_destroy_marks()
Instead of passing spinlock into fsnotify_destroy_marks() determine it
directly in that function from the connector type. This will reduce code
churn when changing lock protecting list of marks.
Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify')
-rw-r--r-- | fs/notify/fsnotify.h | 10 | ||||
-rw-r--r-- | fs/notify/mark.c | 9 |
2 files changed, 11 insertions, 8 deletions
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h index 96051780d50e..225924274f8a 100644 --- a/fs/notify/fsnotify.h +++ b/fs/notify/fsnotify.h | |||
@@ -26,19 +26,17 @@ extern struct inode *fsnotify_destroy_inode_mark(struct fsnotify_mark *mark); | |||
26 | extern struct fsnotify_mark *fsnotify_find_mark( | 26 | extern struct fsnotify_mark *fsnotify_find_mark( |
27 | struct fsnotify_mark_connector *conn, | 27 | struct fsnotify_mark_connector *conn, |
28 | struct fsnotify_group *group); | 28 | struct fsnotify_group *group); |
29 | /* Destroy all marks connected via given connector protected by 'lock' */ | 29 | /* Destroy all marks connected via given connector */ |
30 | extern void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn, | 30 | extern void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn); |
31 | spinlock_t *lock); | ||
32 | /* run the list of all marks associated with inode and destroy them */ | 31 | /* run the list of all marks associated with inode and destroy them */ |
33 | static inline void fsnotify_clear_marks_by_inode(struct inode *inode) | 32 | static inline void fsnotify_clear_marks_by_inode(struct inode *inode) |
34 | { | 33 | { |
35 | fsnotify_destroy_marks(inode->i_fsnotify_marks, &inode->i_lock); | 34 | fsnotify_destroy_marks(inode->i_fsnotify_marks); |
36 | } | 35 | } |
37 | /* run the list of all marks associated with vfsmount and destroy them */ | 36 | /* run the list of all marks associated with vfsmount and destroy them */ |
38 | static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) | 37 | static inline void fsnotify_clear_marks_by_mount(struct vfsmount *mnt) |
39 | { | 38 | { |
40 | fsnotify_destroy_marks(real_mount(mnt)->mnt_fsnotify_marks, | 39 | fsnotify_destroy_marks(real_mount(mnt)->mnt_fsnotify_marks); |
41 | &mnt->mnt_root->d_lock); | ||
42 | } | 40 | } |
43 | /* prepare for freeing all marks associated with given group */ | 41 | /* prepare for freeing all marks associated with given group */ |
44 | extern void fsnotify_detach_group_marks(struct fsnotify_group *group); | 42 | extern void fsnotify_detach_group_marks(struct fsnotify_group *group); |
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 0830e0af997a..f32ca924c44e 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c | |||
@@ -572,14 +572,19 @@ void fsnotify_detach_group_marks(struct fsnotify_group *group) | |||
572 | } | 572 | } |
573 | } | 573 | } |
574 | 574 | ||
575 | void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn, | 575 | void fsnotify_destroy_marks(struct fsnotify_mark_connector *conn) |
576 | spinlock_t *lock) | ||
577 | { | 576 | { |
578 | struct fsnotify_mark *mark; | 577 | struct fsnotify_mark *mark; |
578 | spinlock_t *lock; | ||
579 | 579 | ||
580 | if (!conn) | 580 | if (!conn) |
581 | return; | 581 | return; |
582 | 582 | ||
583 | if (conn->flags & FSNOTIFY_OBJ_TYPE_INODE) | ||
584 | lock = &conn->inode->i_lock; | ||
585 | else | ||
586 | lock = &conn->mnt->mnt_root->d_lock; | ||
587 | |||
583 | while (1) { | 588 | while (1) { |
584 | /* | 589 | /* |
585 | * We have to be careful since we can race with e.g. | 590 | * We have to be careful since we can race with e.g. |