summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-12-21 10:28:45 -0500
committerJan Kara <jack@suse.cz>2017-04-10 11:37:36 -0400
commitb1362edfe15b20edd3d116cec521aa420b7afb98 (patch)
treeeccc81939c6f25460e11282a5f7b8d76676be700
parent2e37c6ca8d76c362e844c0cf3ebe8ba2e27940cb (diff)
fsnotify: Remove fsnotify_find_{inode|vfsmount}_mark()
These are very thin wrappers, just remove them. Drop fs/notify/vfsmount_mark.c as it is empty now. 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/Makefile2
-rw-r--r--fs/notify/dnotify/dnotify.c4
-rw-r--r--fs/notify/fanotify/fanotify_user.c12
-rw-r--r--fs/notify/fsnotify.h4
-rw-r--r--fs/notify/inode_mark.c10
-rw-r--r--fs/notify/inotify/inotify_user.c2
-rw-r--r--fs/notify/vfsmount_mark.c42
-rw-r--r--include/linux/fsnotify_backend.h8
-rw-r--r--kernel/audit_tree.c3
-rw-r--r--kernel/audit_watch.c2
10 files changed, 18 insertions, 71 deletions
diff --git a/fs/notify/Makefile b/fs/notify/Makefile
index 96d3420d0242..ebb64a0282d1 100644
--- a/fs/notify/Makefile
+++ b/fs/notify/Makefile
@@ -1,5 +1,5 @@
1obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o inode_mark.o \ 1obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o inode_mark.o \
2 mark.o vfsmount_mark.o fdinfo.o 2 mark.o fdinfo.o
3 3
4obj-y += dnotify/ 4obj-y += dnotify/
5obj-y += inotify/ 5obj-y += inotify/
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index 5940c75541a7..b77d8d049e4d 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -157,7 +157,7 @@ void dnotify_flush(struct file *filp, fl_owner_t id)
157 if (!S_ISDIR(inode->i_mode)) 157 if (!S_ISDIR(inode->i_mode))
158 return; 158 return;
159 159
160 fsn_mark = fsnotify_find_inode_mark(dnotify_group, inode); 160 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group);
161 if (!fsn_mark) 161 if (!fsn_mark)
162 return; 162 return;
163 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); 163 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
@@ -313,7 +313,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
313 mutex_lock(&dnotify_group->mark_mutex); 313 mutex_lock(&dnotify_group->mark_mutex);
314 314
315 /* add the new_fsn_mark or find an old one. */ 315 /* add the new_fsn_mark or find an old one. */
316 fsn_mark = fsnotify_find_inode_mark(dnotify_group, inode); 316 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, dnotify_group);
317 if (fsn_mark) { 317 if (fsn_mark) {
318 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); 318 dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark);
319 spin_lock(&fsn_mark->lock); 319 spin_lock(&fsn_mark->lock);
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 24fa3f24b9ad..5a82bbb79f55 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -533,7 +533,8 @@ static int fanotify_remove_vfsmount_mark(struct fsnotify_group *group,
533 int destroy_mark; 533 int destroy_mark;
534 534
535 mutex_lock(&group->mark_mutex); 535 mutex_lock(&group->mark_mutex);
536 fsn_mark = fsnotify_find_vfsmount_mark(group, mnt); 536 fsn_mark = fsnotify_find_mark(&real_mount(mnt)->mnt_fsnotify_marks,
537 group);
537 if (!fsn_mark) { 538 if (!fsn_mark) {
538 mutex_unlock(&group->mark_mutex); 539 mutex_unlock(&group->mark_mutex);
539 return -ENOENT; 540 return -ENOENT;
@@ -562,7 +563,7 @@ static int fanotify_remove_inode_mark(struct fsnotify_group *group,
562 int destroy_mark; 563 int destroy_mark;
563 564
564 mutex_lock(&group->mark_mutex); 565 mutex_lock(&group->mark_mutex);
565 fsn_mark = fsnotify_find_inode_mark(group, inode); 566 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
566 if (!fsn_mark) { 567 if (!fsn_mark) {
567 mutex_unlock(&group->mark_mutex); 568 mutex_unlock(&group->mark_mutex);
568 return -ENOENT; 569 return -ENOENT;
@@ -578,7 +579,7 @@ static int fanotify_remove_inode_mark(struct fsnotify_group *group,
578 if (destroy_mark) 579 if (destroy_mark)
579 fsnotify_free_mark(fsn_mark); 580 fsnotify_free_mark(fsn_mark);
580 581
581 /* matches the fsnotify_find_inode_mark() */ 582 /* matches the fsnotify_find_mark() */
582 fsnotify_put_mark(fsn_mark); 583 fsnotify_put_mark(fsn_mark);
583 584
584 return 0; 585 return 0;
@@ -646,7 +647,8 @@ static int fanotify_add_vfsmount_mark(struct fsnotify_group *group,
646 __u32 added; 647 __u32 added;
647 648
648 mutex_lock(&group->mark_mutex); 649 mutex_lock(&group->mark_mutex);
649 fsn_mark = fsnotify_find_vfsmount_mark(group, mnt); 650 fsn_mark = fsnotify_find_mark(&real_mount(mnt)->mnt_fsnotify_marks,
651 group);
650 if (!fsn_mark) { 652 if (!fsn_mark) {
651 fsn_mark = fanotify_add_new_mark(group, NULL, mnt); 653 fsn_mark = fanotify_add_new_mark(group, NULL, mnt);
652 if (IS_ERR(fsn_mark)) { 654 if (IS_ERR(fsn_mark)) {
@@ -683,7 +685,7 @@ static int fanotify_add_inode_mark(struct fsnotify_group *group,
683 return 0; 685 return 0;
684 686
685 mutex_lock(&group->mark_mutex); 687 mutex_lock(&group->mark_mutex);
686 fsn_mark = fsnotify_find_inode_mark(group, inode); 688 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
687 if (!fsn_mark) { 689 if (!fsn_mark) {
688 fsn_mark = fanotify_add_new_mark(group, inode, NULL); 690 fsn_mark = fanotify_add_new_mark(group, inode, NULL);
689 if (IS_ERR(fsn_mark)) { 691 if (IS_ERR(fsn_mark)) {
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h
index 3ec593c32684..bf012e8ecd14 100644
--- a/fs/notify/fsnotify.h
+++ b/fs/notify/fsnotify.h
@@ -24,10 +24,6 @@ extern struct srcu_struct fsnotify_mark_srcu;
24extern int fsnotify_compare_groups(struct fsnotify_group *a, 24extern int fsnotify_compare_groups(struct fsnotify_group *a,
25 struct fsnotify_group *b); 25 struct fsnotify_group *b);
26 26
27/* Find mark belonging to given group in the list of marks */
28extern struct fsnotify_mark *fsnotify_find_mark(
29 struct fsnotify_mark_connector __rcu **connp,
30 struct fsnotify_group *group);
31/* Destroy all marks connected via given connector */ 27/* Destroy all marks connected via given connector */
32extern void fsnotify_destroy_marks(struct fsnotify_mark_connector __rcu **connp); 28extern void fsnotify_destroy_marks(struct fsnotify_mark_connector __rcu **connp);
33/* run the list of all marks associated with inode and destroy them */ 29/* run the list of all marks associated with inode and destroy them */
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
index bdc15f736082..5cc317bad082 100644
--- a/fs/notify/inode_mark.c
+++ b/fs/notify/inode_mark.c
@@ -30,16 +30,6 @@
30 30
31#include "../internal.h" 31#include "../internal.h"
32 32
33/*
34 * given a group and inode, find the mark associated with that combination.
35 * if found take a reference to that mark and return it, else return NULL
36 */
37struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group,
38 struct inode *inode)
39{
40 return fsnotify_find_mark(&inode->i_fsnotify_marks, group);
41}
42
43/** 33/**
44 * fsnotify_unmount_inodes - an sb is unmounting. handle any watched inodes. 34 * fsnotify_unmount_inodes - an sb is unmounting. handle any watched inodes.
45 * @sb: superblock being unmounted. 35 * @sb: superblock being unmounted.
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index b3b2a464a03c..a5e4411362f2 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -506,7 +506,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
506 506
507 mask = inotify_arg_to_mask(arg); 507 mask = inotify_arg_to_mask(arg);
508 508
509 fsn_mark = fsnotify_find_inode_mark(group, inode); 509 fsn_mark = fsnotify_find_mark(&inode->i_fsnotify_marks, group);
510 if (!fsn_mark) 510 if (!fsn_mark)
511 return -ENOENT; 511 return -ENOENT;
512 512
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c
deleted file mode 100644
index 1e692c56deec..000000000000
--- a/fs/notify/vfsmount_mark.c
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * Copyright (C) 2008 Red Hat, Inc., Eric Paris <eparis@redhat.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#include <linux/fs.h>
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/module.h>
23#include <linux/mount.h>
24#include <linux/mutex.h>
25#include <linux/spinlock.h>
26
27#include <linux/atomic.h>
28
29#include <linux/fsnotify_backend.h>
30#include "fsnotify.h"
31
32/*
33 * given a group and vfsmount, find the mark associated with that combination.
34 * if found take a reference to that mark and return it, else return NULL
35 */
36struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group,
37 struct vfsmount *mnt)
38{
39 struct mount *m = real_mount(mnt);
40
41 return fsnotify_find_mark(&m->mnt_fsnotify_marks, group);
42}
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index 7287cba42a66..2ef0e04c5a9d 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -341,10 +341,10 @@ extern struct fsnotify_event *fsnotify_remove_first_event(struct fsnotify_group
341/* Calculate mask of events for a list of marks */ 341/* Calculate mask of events for a list of marks */
342extern void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn); 342extern void fsnotify_recalc_mask(struct fsnotify_mark_connector *conn);
343extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark)); 343extern void fsnotify_init_mark(struct fsnotify_mark *mark, void (*free_mark)(struct fsnotify_mark *mark));
344/* find (and take a reference) to a mark associated with group and inode */ 344/* Find mark belonging to given group in the list of marks */
345extern struct fsnotify_mark *fsnotify_find_inode_mark(struct fsnotify_group *group, struct inode *inode); 345extern struct fsnotify_mark *fsnotify_find_mark(
346/* find (and take a reference) to a mark associated with group and vfsmount */ 346 struct fsnotify_mark_connector __rcu **connp,
347extern struct fsnotify_mark *fsnotify_find_vfsmount_mark(struct fsnotify_group *group, struct vfsmount *mnt); 347 struct fsnotify_group *group);
348/* attach the mark to both the group and the inode */ 348/* attach the mark to both the group and the inode */
349extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, 349extern int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group,
350 struct inode *inode, struct vfsmount *mnt, int allow_dups); 350 struct inode *inode, struct vfsmount *mnt, int allow_dups);
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index d59ed4c9037a..3cc5b92de765 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -391,7 +391,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
391 struct node *p; 391 struct node *p;
392 int n; 392 int n;
393 393
394 old_entry = fsnotify_find_inode_mark(audit_tree_group, inode); 394 old_entry = fsnotify_find_mark(&inode->i_fsnotify_marks,
395 audit_tree_group);
395 if (!old_entry) 396 if (!old_entry)
396 return create_chunk(inode, tree); 397 return create_chunk(inode, tree);
397 398
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c
index 6caaf087801f..956fa584c239 100644
--- a/kernel/audit_watch.c
+++ b/kernel/audit_watch.c
@@ -102,7 +102,7 @@ static inline struct audit_parent *audit_find_parent(struct inode *inode)
102 struct audit_parent *parent = NULL; 102 struct audit_parent *parent = NULL;
103 struct fsnotify_mark *entry; 103 struct fsnotify_mark *entry;
104 104
105 entry = fsnotify_find_inode_mark(audit_watch_group, inode); 105 entry = fsnotify_find_mark(&inode->i_fsnotify_marks, audit_watch_group);
106 if (entry) 106 if (entry)
107 parent = container_of(entry, struct audit_parent, mark); 107 parent = container_of(entry, struct audit_parent, mark);
108 108