diff options
author | Eric Paris <eparis@redhat.com> | 2009-12-17 21:24:23 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 09:58:51 -0400 |
commit | 19c2a0e1a2f60112c158342ba5f568f72b741c2c (patch) | |
tree | 807520e66657e25420389c376cccaf5ca283f346 | |
parent | 0d2e2a1d00d7d23e5bd9bb0935cde7c3d5835c56 (diff) |
fsnotify: rename fsnotify_groups to fsnotify_inode_groups
Simple renaming patch. fsnotify is about to support mount point listeners
so I am renaming fsnotify_groups and fsnotify_mask to indicate these are lists
used only for groups which have watches on inodes.
Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r-- | fs/notify/fsnotify.c | 6 | ||||
-rw-r--r-- | fs/notify/fsnotify.h | 8 | ||||
-rw-r--r-- | fs/notify/group.c | 30 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 6 |
4 files changed, 29 insertions, 21 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 806beede24a3..23b5cfbeed50 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -148,10 +148,10 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const | |||
148 | /* global tests shouldn't care about events on child only the specific event */ | 148 | /* global tests shouldn't care about events on child only the specific event */ |
149 | __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); | 149 | __u32 test_mask = (mask & ~FS_EVENT_ON_CHILD); |
150 | 150 | ||
151 | if (list_empty(&fsnotify_groups)) | 151 | if (list_empty(&fsnotify_inode_groups)) |
152 | return; | 152 | return; |
153 | 153 | ||
154 | if (!(test_mask & fsnotify_mask)) | 154 | if (!(test_mask & fsnotify_inode_mask)) |
155 | return; | 155 | return; |
156 | 156 | ||
157 | if (!(test_mask & to_tell->i_fsnotify_mask)) | 157 | if (!(test_mask & to_tell->i_fsnotify_mask)) |
@@ -162,7 +162,7 @@ void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const | |||
162 | * anything other than walk the list so it's crazy to pre-allocate. | 162 | * anything other than walk the list so it's crazy to pre-allocate. |
163 | */ | 163 | */ |
164 | idx = srcu_read_lock(&fsnotify_grp_srcu); | 164 | idx = srcu_read_lock(&fsnotify_grp_srcu); |
165 | list_for_each_entry_rcu(group, &fsnotify_groups, group_list) { | 165 | list_for_each_entry_rcu(group, &fsnotify_inode_groups, inode_group_list) { |
166 | if (test_mask & group->mask) { | 166 | if (test_mask & group->mask) { |
167 | if (!group->ops->should_send_event(group, to_tell, mask, | 167 | if (!group->ops->should_send_event(group, to_tell, mask, |
168 | data, data_is)) | 168 | data, data_is)) |
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h index 4dc240824b2d..ec5aee43bdc5 100644 --- a/fs/notify/fsnotify.h +++ b/fs/notify/fsnotify.h | |||
@@ -8,10 +8,10 @@ | |||
8 | 8 | ||
9 | /* protects reads of fsnotify_groups */ | 9 | /* protects reads of fsnotify_groups */ |
10 | extern struct srcu_struct fsnotify_grp_srcu; | 10 | extern struct srcu_struct fsnotify_grp_srcu; |
11 | /* all groups which receive fsnotify events */ | 11 | /* all groups which receive inode fsnotify events */ |
12 | extern struct list_head fsnotify_groups; | 12 | extern struct list_head fsnotify_inode_groups; |
13 | /* all bitwise OR of all event types (FS_*) for all fsnotify_groups */ | 13 | /* all bitwise OR of all event types (FS_*) for all fsnotify_inode_groups */ |
14 | extern __u32 fsnotify_mask; | 14 | extern __u32 fsnotify_inode_mask; |
15 | 15 | ||
16 | /* destroy all events sitting in this groups notification queue */ | 16 | /* destroy all events sitting in this groups notification queue */ |
17 | extern void fsnotify_flush_notify(struct fsnotify_group *group); | 17 | extern void fsnotify_flush_notify(struct fsnotify_group *group); |
diff --git a/fs/notify/group.c b/fs/notify/group.c index 1657349c30a6..c80809745312 100644 --- a/fs/notify/group.c +++ b/fs/notify/group.c | |||
@@ -33,9 +33,9 @@ static DEFINE_MUTEX(fsnotify_grp_mutex); | |||
33 | /* protects reads while running the fsnotify_groups list */ | 33 | /* protects reads while running the fsnotify_groups list */ |
34 | struct srcu_struct fsnotify_grp_srcu; | 34 | struct srcu_struct fsnotify_grp_srcu; |
35 | /* all groups registered to receive filesystem notifications */ | 35 | /* all groups registered to receive filesystem notifications */ |
36 | LIST_HEAD(fsnotify_groups); | 36 | LIST_HEAD(fsnotify_inode_groups); |
37 | /* bitwise OR of all events (FS_*) interesting to some group on this system */ | 37 | /* bitwise OR of all events (FS_*) interesting to some group on this system */ |
38 | __u32 fsnotify_mask; | 38 | __u32 fsnotify_inode_mask; |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * When a new group registers or changes it's set of interesting events | 41 | * When a new group registers or changes it's set of interesting events |
@@ -48,10 +48,10 @@ void fsnotify_recalc_global_mask(void) | |||
48 | int idx; | 48 | int idx; |
49 | 49 | ||
50 | idx = srcu_read_lock(&fsnotify_grp_srcu); | 50 | idx = srcu_read_lock(&fsnotify_grp_srcu); |
51 | list_for_each_entry_rcu(group, &fsnotify_groups, group_list) | 51 | list_for_each_entry_rcu(group, &fsnotify_inode_groups, inode_group_list) |
52 | mask |= group->mask; | 52 | mask |= group->mask; |
53 | srcu_read_unlock(&fsnotify_grp_srcu, idx); | 53 | srcu_read_unlock(&fsnotify_grp_srcu, idx); |
54 | fsnotify_mask = mask; | 54 | fsnotify_inode_mask = mask; |
55 | } | 55 | } |
56 | 56 | ||
57 | /* | 57 | /* |
@@ -77,6 +77,17 @@ void fsnotify_recalc_group_mask(struct fsnotify_group *group) | |||
77 | fsnotify_recalc_global_mask(); | 77 | fsnotify_recalc_global_mask(); |
78 | } | 78 | } |
79 | 79 | ||
80 | static void fsnotify_add_group(struct fsnotify_group *group) | ||
81 | { | ||
82 | BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex)); | ||
83 | |||
84 | group->on_inode_group_list = 1; | ||
85 | /* being on the fsnotify_groups list holds one num_marks */ | ||
86 | atomic_inc(&group->num_marks); | ||
87 | |||
88 | list_add_tail_rcu(&group->inode_group_list, &fsnotify_inode_groups); | ||
89 | } | ||
90 | |||
80 | /* | 91 | /* |
81 | * Final freeing of a group | 92 | * Final freeing of a group |
82 | */ | 93 | */ |
@@ -118,9 +129,9 @@ static void __fsnotify_evict_group(struct fsnotify_group *group) | |||
118 | { | 129 | { |
119 | BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex)); | 130 | BUG_ON(!mutex_is_locked(&fsnotify_grp_mutex)); |
120 | 131 | ||
121 | if (group->on_group_list) | 132 | if (group->on_inode_group_list) |
122 | list_del_rcu(&group->group_list); | 133 | list_del_rcu(&group->inode_group_list); |
123 | group->on_group_list = 0; | 134 | group->on_inode_group_list = 0; |
124 | } | 135 | } |
125 | 136 | ||
126 | /* | 137 | /* |
@@ -186,10 +197,7 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops) | |||
186 | 197 | ||
187 | mutex_lock(&fsnotify_grp_mutex); | 198 | mutex_lock(&fsnotify_grp_mutex); |
188 | 199 | ||
189 | list_add_rcu(&group->group_list, &fsnotify_groups); | 200 | fsnotify_add_group(group); |
190 | group->on_group_list = 1; | ||
191 | /* being on the fsnotify_groups list holds one num_marks */ | ||
192 | atomic_inc(&group->num_marks); | ||
193 | 201 | ||
194 | mutex_unlock(&fsnotify_grp_mutex); | 202 | mutex_unlock(&fsnotify_grp_mutex); |
195 | 203 | ||
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 58326049ab29..21079ade5620 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -95,10 +95,10 @@ struct fsnotify_ops { | |||
95 | struct fsnotify_group { | 95 | struct fsnotify_group { |
96 | /* | 96 | /* |
97 | * global list of all groups receiving events from fsnotify. | 97 | * global list of all groups receiving events from fsnotify. |
98 | * anchored by fsnotify_groups and protected by either fsnotify_grp_mutex | 98 | * anchored by fsnotify_inode_groups and protected by either fsnotify_grp_mutex |
99 | * or fsnotify_grp_srcu depending on write vs read. | 99 | * or fsnotify_grp_srcu depending on write vs read. |
100 | */ | 100 | */ |
101 | struct list_head group_list; | 101 | struct list_head inode_group_list; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Defines all of the event types in which this group is interested. | 104 | * Defines all of the event types in which this group is interested. |
@@ -136,7 +136,7 @@ struct fsnotify_group { | |||
136 | struct list_head mark_entries; /* all inode mark entries for this group */ | 136 | struct list_head mark_entries; /* all inode mark entries for this group */ |
137 | 137 | ||
138 | /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */ | 138 | /* prevents double list_del of group_list. protected by global fsnotify_grp_mutex */ |
139 | bool on_group_list; | 139 | bool on_inode_group_list; |
140 | 140 | ||
141 | /* groups can define private fields here or use the void *private */ | 141 | /* groups can define private fields here or use the void *private */ |
142 | union { | 142 | union { |