diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-29 18:35:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-05-29 18:35:12 -0400 |
commit | affda48410a5bbfd516def60bbc97f2683cd9f7b (patch) | |
tree | f54b2612ec4b6d8cf5bfbd4f5dbb300b2de7da75 | |
parent | 77d5a6b7d9924e2ebb96c6e80bb9fc78615e41b5 (diff) |
trim fsnotify hooks a bit
fsnotify_d_move()/__fsnotify_d_instantiate()/__fsnotify_update_dcache_flags()
are identical to each other, regardless of the config.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/dcache.c | 8 | ||||
-rw-r--r-- | include/linux/fsnotify.h | 12 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 20 |
3 files changed, 7 insertions, 33 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index ad4a542e9bab..f9c63c108881 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1769,7 +1769,7 @@ static void __d_instantiate(struct dentry *dentry, struct inode *inode) | |||
1769 | raw_write_seqcount_begin(&dentry->d_seq); | 1769 | raw_write_seqcount_begin(&dentry->d_seq); |
1770 | __d_set_inode_and_type(dentry, inode, add_flags); | 1770 | __d_set_inode_and_type(dentry, inode, add_flags); |
1771 | raw_write_seqcount_end(&dentry->d_seq); | 1771 | raw_write_seqcount_end(&dentry->d_seq); |
1772 | __fsnotify_d_instantiate(dentry); | 1772 | fsnotify_update_flags(dentry); |
1773 | spin_unlock(&dentry->d_lock); | 1773 | spin_unlock(&dentry->d_lock); |
1774 | } | 1774 | } |
1775 | 1775 | ||
@@ -2563,7 +2563,7 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode) | |||
2563 | raw_write_seqcount_begin(&dentry->d_seq); | 2563 | raw_write_seqcount_begin(&dentry->d_seq); |
2564 | __d_set_inode_and_type(dentry, inode, add_flags); | 2564 | __d_set_inode_and_type(dentry, inode, add_flags); |
2565 | raw_write_seqcount_end(&dentry->d_seq); | 2565 | raw_write_seqcount_end(&dentry->d_seq); |
2566 | __fsnotify_d_instantiate(dentry); | 2566 | fsnotify_update_flags(dentry); |
2567 | } | 2567 | } |
2568 | _d_rehash(dentry); | 2568 | _d_rehash(dentry); |
2569 | if (dir) | 2569 | if (dir) |
@@ -2853,8 +2853,8 @@ static void __d_move(struct dentry *dentry, struct dentry *target, | |||
2853 | list_move(&target->d_child, &target->d_parent->d_subdirs); | 2853 | list_move(&target->d_child, &target->d_parent->d_subdirs); |
2854 | list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); | 2854 | list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); |
2855 | if (exchange) | 2855 | if (exchange) |
2856 | fsnotify_d_move(target); | 2856 | fsnotify_update_flags(target); |
2857 | fsnotify_d_move(dentry); | 2857 | fsnotify_update_flags(dentry); |
2858 | } | 2858 | } |
2859 | 2859 | ||
2860 | write_seqcount_end(&target->d_seq); | 2860 | write_seqcount_end(&target->d_seq); |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 0141f257d67b..eed9e853a06f 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -52,18 +52,6 @@ static inline int fsnotify_perm(struct file *file, int mask) | |||
52 | } | 52 | } |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * fsnotify_d_move - dentry has been moved | ||
56 | */ | ||
57 | static inline void fsnotify_d_move(struct dentry *dentry) | ||
58 | { | ||
59 | /* | ||
60 | * On move we need to update dentry->d_flags to indicate if the new parent | ||
61 | * cares about events from this dentry. | ||
62 | */ | ||
63 | __fsnotify_update_dcache_flags(dentry); | ||
64 | } | ||
65 | |||
66 | /* | ||
67 | * fsnotify_link_count - inode's link count changed | 55 | * fsnotify_link_count - inode's link count changed |
68 | */ | 56 | */ |
69 | static inline void fsnotify_link_count(struct inode *inode) | 57 | static inline void fsnotify_link_count(struct inode *inode) |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index d188a107c562..58205f33af02 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -267,10 +267,8 @@ static inline int fsnotify_inode_watches_children(struct inode *inode) | |||
267 | * Update the dentry with a flag indicating the interest of its parent to receive | 267 | * Update the dentry with a flag indicating the interest of its parent to receive |
268 | * filesystem events when those events happens to this dentry->d_inode. | 268 | * filesystem events when those events happens to this dentry->d_inode. |
269 | */ | 269 | */ |
270 | static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) | 270 | static inline void fsnotify_update_flags(struct dentry *dentry) |
271 | { | 271 | { |
272 | struct dentry *parent; | ||
273 | |||
274 | assert_spin_locked(&dentry->d_lock); | 272 | assert_spin_locked(&dentry->d_lock); |
275 | 273 | ||
276 | /* | 274 | /* |
@@ -280,21 +278,12 @@ static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) | |||
280 | * find our entry, so it will spin until we complete here, and update | 278 | * find our entry, so it will spin until we complete here, and update |
281 | * us with the new state. | 279 | * us with the new state. |
282 | */ | 280 | */ |
283 | parent = dentry->d_parent; | 281 | if (fsnotify_inode_watches_children(dentry->d_parent->d_inode)) |
284 | if (fsnotify_inode_watches_children(parent->d_inode)) | ||
285 | dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED; | 282 | dentry->d_flags |= DCACHE_FSNOTIFY_PARENT_WATCHED; |
286 | else | 283 | else |
287 | dentry->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED; | 284 | dentry->d_flags &= ~DCACHE_FSNOTIFY_PARENT_WATCHED; |
288 | } | 285 | } |
289 | 286 | ||
290 | /* | ||
291 | * fsnotify_d_instantiate - instantiate a dentry for inode | ||
292 | */ | ||
293 | static inline void __fsnotify_d_instantiate(struct dentry *dentry) | ||
294 | { | ||
295 | __fsnotify_update_dcache_flags(dentry); | ||
296 | } | ||
297 | |||
298 | /* called from fsnotify listeners, such as fanotify or dnotify */ | 287 | /* called from fsnotify listeners, such as fanotify or dnotify */ |
299 | 288 | ||
300 | /* create a new group */ | 289 | /* create a new group */ |
@@ -386,10 +375,7 @@ static inline void __fsnotify_inode_delete(struct inode *inode) | |||
386 | static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) | 375 | static inline void __fsnotify_vfsmount_delete(struct vfsmount *mnt) |
387 | {} | 376 | {} |
388 | 377 | ||
389 | static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) | 378 | static inline void fsnotify_update_flags(struct dentry *dentry) |
390 | {} | ||
391 | |||
392 | static inline void __fsnotify_d_instantiate(struct dentry *dentry) | ||
393 | {} | 379 | {} |
394 | 380 | ||
395 | static inline u32 fsnotify_get_cookie(void) | 381 | static inline u32 fsnotify_get_cookie(void) |