aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/inode_mark.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-12-17 21:24:24 -0500
committerEric Paris <eparis@redhat.com>2010-07-28 09:58:53 -0400
commite61ce86737b4d60521e4e71f9892fe4bdcfb688b (patch)
treea1aba411504ac028d4ead6f28ca05bd024c74142 /fs/notify/inode_mark.c
parent72acc854427948efed7a83da27f7dc3239ac9afc (diff)
fsnotify: rename fsnotify_mark_entry to just fsnotify_mark
The name is long and it serves no real purpose. So rename fsnotify_mark_entry to just fsnotify_mark. Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/inode_mark.c')
-rw-r--r--fs/notify/inode_mark.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c
index b00065842b3e..7e69f6b08d4e 100644
--- a/fs/notify/inode_mark.c
+++ b/fs/notify/inode_mark.c
@@ -38,12 +38,12 @@
38 * that lock to dereference either of these things (they could be NULL even with 38 * that lock to dereference either of these things (they could be NULL even with
39 * the lock) 39 * the lock)
40 * 40 *
41 * group->mark_lock protects the mark_entries list anchored inside a given group 41 * group->mark_lock protects the marks_list anchored inside a given group
42 * and each entry is hooked via the g_list. It also sorta protects the 42 * and each entry is hooked via the g_list. It also sorta protects the
43 * free_g_list, which when used is anchored by a private list on the stack of the 43 * free_g_list, which when used is anchored by a private list on the stack of the
44 * task which held the group->mark_lock. 44 * task which held the group->mark_lock.
45 * 45 *
46 * inode->i_lock protects the i_fsnotify_mark_entries list anchored inside a 46 * inode->i_lock protects the i_fsnotify_marks list anchored inside a
47 * given inode and each entry is hooked via the i_list. (and sorta the 47 * given inode and each entry is hooked via the i_list. (and sorta the
48 * free_i_list) 48 * free_i_list)
49 * 49 *
@@ -61,7 +61,7 @@
61 * need to be cleaned up. (fsnotify_clear_marks_by_group) 61 * need to be cleaned up. (fsnotify_clear_marks_by_group)
62 * 62 *
63 * Worst case we are given an inode and need to clean up all the marks on that 63 * Worst case we are given an inode and need to clean up all the marks on that
64 * inode. We take i_lock and walk the i_fsnotify_mark_entries safely. For each 64 * inode. We take i_lock and walk the i_fsnotify_marks safely. For each
65 * mark on the list we take a reference (so the mark can't disappear under us). 65 * mark on the list we take a reference (so the mark can't disappear under us).
66 * We remove that mark form the inode's list of marks and we add this mark to a 66 * We remove that mark form the inode's list of marks and we add this mark to a
67 * private list anchored on the stack using i_free_list; At this point we no 67 * private list anchored on the stack using i_free_list; At this point we no
@@ -95,12 +95,12 @@
95#include <linux/fsnotify_backend.h> 95#include <linux/fsnotify_backend.h>
96#include "fsnotify.h" 96#include "fsnotify.h"
97 97
98void fsnotify_get_mark(struct fsnotify_mark_entry *entry) 98void fsnotify_get_mark(struct fsnotify_mark *entry)
99{ 99{
100 atomic_inc(&entry->refcnt); 100 atomic_inc(&entry->refcnt);
101} 101}
102 102
103void fsnotify_put_mark(struct fsnotify_mark_entry *entry) 103void fsnotify_put_mark(struct fsnotify_mark *entry)
104{ 104{
105 if (atomic_dec_and_test(&entry->refcnt)) 105 if (atomic_dec_and_test(&entry->refcnt))
106 entry->free_mark(entry); 106 entry->free_mark(entry);
@@ -111,13 +111,13 @@ void fsnotify_put_mark(struct fsnotify_mark_entry *entry)
111 */ 111 */
112static void fsnotify_recalc_inode_mask_locked(struct inode *inode) 112static void fsnotify_recalc_inode_mask_locked(struct inode *inode)
113{ 113{
114 struct fsnotify_mark_entry *entry; 114 struct fsnotify_mark *entry;
115 struct hlist_node *pos; 115 struct hlist_node *pos;
116 __u32 new_mask = 0; 116 __u32 new_mask = 0;
117 117
118 assert_spin_locked(&inode->i_lock); 118 assert_spin_locked(&inode->i_lock);
119 119
120 hlist_for_each_entry(entry, pos, &inode->i_fsnotify_mark_entries, i.i_list) 120 hlist_for_each_entry(entry, pos, &inode->i_fsnotify_marks, i.i_list)
121 new_mask |= entry->mask; 121 new_mask |= entry->mask;
122 inode->i_fsnotify_mask = new_mask; 122 inode->i_fsnotify_mask = new_mask;
123} 123}
@@ -140,7 +140,7 @@ void fsnotify_recalc_inode_mask(struct inode *inode)
140 * The caller had better be holding a reference to this mark so we don't actually 140 * The caller had better be holding a reference to this mark so we don't actually
141 * do the final put under the entry->lock 141 * do the final put under the entry->lock
142 */ 142 */
143void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry) 143void fsnotify_destroy_mark_by_entry(struct fsnotify_mark *entry)
144{ 144{
145 struct fsnotify_group *group; 145 struct fsnotify_group *group;
146 struct inode *inode; 146 struct inode *inode;
@@ -174,7 +174,7 @@ void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry)
174 fsnotify_put_mark(entry); /* for i_list and g_list */ 174 fsnotify_put_mark(entry); /* for i_list and g_list */
175 175
176 /* 176 /*
177 * this mark is now off the inode->i_fsnotify_mark_entries list and we 177 * this mark is now off the inode->i_fsnotify_marks list and we
178 * hold the inode->i_lock, so this is the perfect time to update the 178 * hold the inode->i_lock, so this is the perfect time to update the
179 * inode->i_fsnotify_mask 179 * inode->i_fsnotify_mask
180 */ 180 */
@@ -221,11 +221,11 @@ void fsnotify_destroy_mark_by_entry(struct fsnotify_mark_entry *entry)
221 */ 221 */
222void fsnotify_clear_marks_by_group(struct fsnotify_group *group) 222void fsnotify_clear_marks_by_group(struct fsnotify_group *group)
223{ 223{
224 struct fsnotify_mark_entry *lentry, *entry; 224 struct fsnotify_mark *lentry, *entry;
225 LIST_HEAD(free_list); 225 LIST_HEAD(free_list);
226 226
227 spin_lock(&group->mark_lock); 227 spin_lock(&group->mark_lock);
228 list_for_each_entry_safe(entry, lentry, &group->mark_entries, g_list) { 228 list_for_each_entry_safe(entry, lentry, &group->marks_list, g_list) {
229 list_add(&entry->free_g_list, &free_list); 229 list_add(&entry->free_g_list, &free_list);
230 list_del_init(&entry->g_list); 230 list_del_init(&entry->g_list);
231 fsnotify_get_mark(entry); 231 fsnotify_get_mark(entry);
@@ -243,12 +243,12 @@ void fsnotify_clear_marks_by_group(struct fsnotify_group *group)
243 */ 243 */
244void fsnotify_clear_marks_by_inode(struct inode *inode) 244void fsnotify_clear_marks_by_inode(struct inode *inode)
245{ 245{
246 struct fsnotify_mark_entry *entry, *lentry; 246 struct fsnotify_mark *entry, *lentry;
247 struct hlist_node *pos, *n; 247 struct hlist_node *pos, *n;
248 LIST_HEAD(free_list); 248 LIST_HEAD(free_list);
249 249
250 spin_lock(&inode->i_lock); 250 spin_lock(&inode->i_lock);
251 hlist_for_each_entry_safe(entry, pos, n, &inode->i_fsnotify_mark_entries, i.i_list) { 251 hlist_for_each_entry_safe(entry, pos, n, &inode->i_fsnotify_marks, i.i_list) {
252 list_add(&entry->i.free_i_list, &free_list); 252 list_add(&entry->i.free_i_list, &free_list);
253 hlist_del_init(&entry->i.i_list); 253 hlist_del_init(&entry->i.i_list);
254 fsnotify_get_mark(entry); 254 fsnotify_get_mark(entry);
@@ -265,15 +265,15 @@ void fsnotify_clear_marks_by_inode(struct inode *inode)
265 * given a group and inode, find the mark associated with that combination. 265 * given a group and inode, find the mark associated with that combination.
266 * if found take a reference to that mark and return it, else return NULL 266 * if found take a reference to that mark and return it, else return NULL
267 */ 267 */
268struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *group, 268struct fsnotify_mark *fsnotify_find_mark_entry(struct fsnotify_group *group,
269 struct inode *inode) 269 struct inode *inode)
270{ 270{
271 struct fsnotify_mark_entry *entry; 271 struct fsnotify_mark *entry;
272 struct hlist_node *pos; 272 struct hlist_node *pos;
273 273
274 assert_spin_locked(&inode->i_lock); 274 assert_spin_locked(&inode->i_lock);
275 275
276 hlist_for_each_entry(entry, pos, &inode->i_fsnotify_mark_entries, i.i_list) { 276 hlist_for_each_entry(entry, pos, &inode->i_fsnotify_marks, i.i_list) {
277 if (entry->group == group) { 277 if (entry->group == group) {
278 fsnotify_get_mark(entry); 278 fsnotify_get_mark(entry);
279 return entry; 279 return entry;
@@ -282,7 +282,7 @@ struct fsnotify_mark_entry *fsnotify_find_mark_entry(struct fsnotify_group *grou
282 return NULL; 282 return NULL;
283} 283}
284 284
285void fsnotify_duplicate_mark(struct fsnotify_mark_entry *new, struct fsnotify_mark_entry *old) 285void fsnotify_duplicate_mark(struct fsnotify_mark *new, struct fsnotify_mark *old)
286{ 286{
287 assert_spin_locked(&old->lock); 287 assert_spin_locked(&old->lock);
288 new->i.inode = old->i.inode; 288 new->i.inode = old->i.inode;
@@ -294,8 +294,8 @@ void fsnotify_duplicate_mark(struct fsnotify_mark_entry *new, struct fsnotify_ma
294/* 294/*
295 * Nothing fancy, just initialize lists and locks and counters. 295 * Nothing fancy, just initialize lists and locks and counters.
296 */ 296 */
297void fsnotify_init_mark(struct fsnotify_mark_entry *entry, 297void fsnotify_init_mark(struct fsnotify_mark *entry,
298 void (*free_mark)(struct fsnotify_mark_entry *entry)) 298 void (*free_mark)(struct fsnotify_mark *entry))
299{ 299{
300 spin_lock_init(&entry->lock); 300 spin_lock_init(&entry->lock);
301 atomic_set(&entry->refcnt, 1); 301 atomic_set(&entry->refcnt, 1);
@@ -311,11 +311,11 @@ void fsnotify_init_mark(struct fsnotify_mark_entry *entry,
311 * These marks may be used for the fsnotify backend to determine which 311 * These marks may be used for the fsnotify backend to determine which
312 * event types should be delivered to which group and for which inodes. 312 * event types should be delivered to which group and for which inodes.
313 */ 313 */
314int fsnotify_add_mark(struct fsnotify_mark_entry *entry, 314int fsnotify_add_mark(struct fsnotify_mark *entry,
315 struct fsnotify_group *group, struct inode *inode, 315 struct fsnotify_group *group, struct inode *inode,
316 int allow_dups) 316 int allow_dups)
317{ 317{
318 struct fsnotify_mark_entry *lentry = NULL; 318 struct fsnotify_mark *lentry = NULL;
319 int ret = 0; 319 int ret = 0;
320 320
321 inode = igrab(inode); 321 inode = igrab(inode);
@@ -354,8 +354,8 @@ int fsnotify_add_mark(struct fsnotify_mark_entry *entry,
354 entry->group = group; 354 entry->group = group;
355 entry->i.inode = inode; 355 entry->i.inode = inode;
356 356
357 hlist_add_head(&entry->i.i_list, &inode->i_fsnotify_mark_entries); 357 hlist_add_head(&entry->i.i_list, &inode->i_fsnotify_marks);
358 list_add(&entry->g_list, &group->mark_entries); 358 list_add(&entry->g_list, &group->marks_list);
359 359
360 fsnotify_get_mark(entry); /* for i_list and g_list */ 360 fsnotify_get_mark(entry); /* for i_list and g_list */
361 361