diff options
author | Jan Kara <jack@suse.cz> | 2016-12-21 10:40:48 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-04-10 11:37:36 -0400 |
commit | ebb3b47e37a4ccef33e6388589a21a5c23d6b40b (patch) | |
tree | 2d6a1d438c8fd28e6ab39e7cd452d696345112d5 | |
parent | b1362edfe15b20edd3d116cec521aa420b7afb98 (diff) |
fsnotify: Drop inode_mark.c
inode_mark.c now contains only a single function. Move it to
fs/notify/fsnotify.c and remove inode_mark.c.
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/Makefile | 4 | ||||
-rw-r--r-- | fs/notify/fsnotify.c | 57 | ||||
-rw-r--r-- | fs/notify/inode_mark.c | 88 |
3 files changed, 59 insertions, 90 deletions
diff --git a/fs/notify/Makefile b/fs/notify/Makefile index ebb64a0282d1..3e969ae91b60 100644 --- a/fs/notify/Makefile +++ b/fs/notify/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o inode_mark.o \ | 1 | obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o mark.o \ |
2 | mark.o fdinfo.o | 2 | fdinfo.o |
3 | 3 | ||
4 | obj-y += dnotify/ | 4 | obj-y += dnotify/ |
5 | obj-y += inotify/ | 5 | obj-y += inotify/ |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index c4afb6a88268..01a9f0f007d4 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -41,6 +41,63 @@ void __fsnotify_vfsmount_delete(struct vfsmount *mnt) | |||
41 | fsnotify_clear_marks_by_mount(mnt); | 41 | fsnotify_clear_marks_by_mount(mnt); |
42 | } | 42 | } |
43 | 43 | ||
44 | /** | ||
45 | * fsnotify_unmount_inodes - an sb is unmounting. handle any watched inodes. | ||
46 | * @sb: superblock being unmounted. | ||
47 | * | ||
48 | * Called during unmount with no locks held, so needs to be safe against | ||
49 | * concurrent modifiers. We temporarily drop sb->s_inode_list_lock and CAN block. | ||
50 | */ | ||
51 | void fsnotify_unmount_inodes(struct super_block *sb) | ||
52 | { | ||
53 | struct inode *inode, *iput_inode = NULL; | ||
54 | |||
55 | spin_lock(&sb->s_inode_list_lock); | ||
56 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | ||
57 | /* | ||
58 | * We cannot __iget() an inode in state I_FREEING, | ||
59 | * I_WILL_FREE, or I_NEW which is fine because by that point | ||
60 | * the inode cannot have any associated watches. | ||
61 | */ | ||
62 | spin_lock(&inode->i_lock); | ||
63 | if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) { | ||
64 | spin_unlock(&inode->i_lock); | ||
65 | continue; | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * If i_count is zero, the inode cannot have any watches and | ||
70 | * doing an __iget/iput with MS_ACTIVE clear would actually | ||
71 | * evict all inodes with zero i_count from icache which is | ||
72 | * unnecessarily violent and may in fact be illegal to do. | ||
73 | */ | ||
74 | if (!atomic_read(&inode->i_count)) { | ||
75 | spin_unlock(&inode->i_lock); | ||
76 | continue; | ||
77 | } | ||
78 | |||
79 | __iget(inode); | ||
80 | spin_unlock(&inode->i_lock); | ||
81 | spin_unlock(&sb->s_inode_list_lock); | ||
82 | |||
83 | if (iput_inode) | ||
84 | iput(iput_inode); | ||
85 | |||
86 | /* for each watch, send FS_UNMOUNT and then remove it */ | ||
87 | fsnotify(inode, FS_UNMOUNT, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | ||
88 | |||
89 | fsnotify_inode_delete(inode); | ||
90 | |||
91 | iput_inode = inode; | ||
92 | |||
93 | spin_lock(&sb->s_inode_list_lock); | ||
94 | } | ||
95 | spin_unlock(&sb->s_inode_list_lock); | ||
96 | |||
97 | if (iput_inode) | ||
98 | iput(iput_inode); | ||
99 | } | ||
100 | |||
44 | /* | 101 | /* |
45 | * Given an inode, first check if we care what happens to our children. Inotify | 102 | * Given an inode, first check if we care what happens to our children. Inotify |
46 | * and dnotify both tell their parents about events. If we care about any event | 103 | * and dnotify both tell their parents about events. If we care about any event |
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c deleted file mode 100644 index 5cc317bad082..000000000000 --- a/fs/notify/inode_mark.c +++ /dev/null | |||
@@ -1,88 +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/mutex.h> | ||
24 | #include <linux/spinlock.h> | ||
25 | |||
26 | #include <linux/atomic.h> | ||
27 | |||
28 | #include <linux/fsnotify_backend.h> | ||
29 | #include "fsnotify.h" | ||
30 | |||
31 | #include "../internal.h" | ||
32 | |||
33 | /** | ||
34 | * fsnotify_unmount_inodes - an sb is unmounting. handle any watched inodes. | ||
35 | * @sb: superblock being unmounted. | ||
36 | * | ||
37 | * Called during unmount with no locks held, so needs to be safe against | ||
38 | * concurrent modifiers. We temporarily drop sb->s_inode_list_lock and CAN block. | ||
39 | */ | ||
40 | void fsnotify_unmount_inodes(struct super_block *sb) | ||
41 | { | ||
42 | struct inode *inode, *iput_inode = NULL; | ||
43 | |||
44 | spin_lock(&sb->s_inode_list_lock); | ||
45 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | ||
46 | /* | ||
47 | * We cannot __iget() an inode in state I_FREEING, | ||
48 | * I_WILL_FREE, or I_NEW which is fine because by that point | ||
49 | * the inode cannot have any associated watches. | ||
50 | */ | ||
51 | spin_lock(&inode->i_lock); | ||
52 | if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) { | ||
53 | spin_unlock(&inode->i_lock); | ||
54 | continue; | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * If i_count is zero, the inode cannot have any watches and | ||
59 | * doing an __iget/iput with MS_ACTIVE clear would actually | ||
60 | * evict all inodes with zero i_count from icache which is | ||
61 | * unnecessarily violent and may in fact be illegal to do. | ||
62 | */ | ||
63 | if (!atomic_read(&inode->i_count)) { | ||
64 | spin_unlock(&inode->i_lock); | ||
65 | continue; | ||
66 | } | ||
67 | |||
68 | __iget(inode); | ||
69 | spin_unlock(&inode->i_lock); | ||
70 | spin_unlock(&sb->s_inode_list_lock); | ||
71 | |||
72 | if (iput_inode) | ||
73 | iput(iput_inode); | ||
74 | |||
75 | /* for each watch, send FS_UNMOUNT and then remove it */ | ||
76 | fsnotify(inode, FS_UNMOUNT, inode, FSNOTIFY_EVENT_INODE, NULL, 0); | ||
77 | |||
78 | fsnotify_inode_delete(inode); | ||
79 | |||
80 | iput_inode = inode; | ||
81 | |||
82 | spin_lock(&sb->s_inode_list_lock); | ||
83 | } | ||
84 | spin_unlock(&sb->s_inode_list_lock); | ||
85 | |||
86 | if (iput_inode) | ||
87 | iput(iput_inode); | ||
88 | } | ||