• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/notify/

Lines Matching defs:mark

20  * fsnotify inode mark locking/lifetime/and refcnting
23 * The mark->refcnt tells how many "things" in the kernel currently are
33 * mark->lock
37 * mark->lock protects 2 things, mark->group and mark->inode. You must hold
42 * and each mark is hooked via the g_list. It also sorta protects the
47 * given inode and each mark is hooked via the i_list. (and sorta the
55 * The inode mark can be cleared for a number of different reasons including:
60 * - The fsnotify_group associated with the mark is going away and all such marks
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
68 * longer fear anything finding the mark using the inode's list of marks.
71 * we just unattached from the original inode. For each mark on the private list
72 * we grab the mark-> and can thus dereference mark->group and mark->inode. If
74 * 3 locks we can completely remove the mark from other tasks finding it in the
75 * future. Remember, 10 things might already be referencing this mark, but they
77 * from the inode. When the ref hits 0 we can free the mark.
106 void fsnotify_get_mark(struct fsnotify_mark *mark)
108 atomic_inc(&mark->refcnt);
111 void fsnotify_put_mark(struct fsnotify_mark *mark)
113 if (atomic_dec_and_test(&mark->refcnt))
114 mark->free_mark(mark);
118 * Any time a mark is getting freed we end up here.
119 * The caller had better be holding a reference to this mark so we don't actually
120 * do the final put under the mark->lock
122 void fsnotify_destroy_mark(struct fsnotify_mark *mark)
127 spin_lock(&mark->lock);
129 group = mark->group;
131 /* something else already called this function on this mark */
132 if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE)) {
133 spin_unlock(&mark->lock);
137 mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
140 BUG_ON(atomic_read(&mark->refcnt) < 2);
144 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) {
145 inode = mark->i.inode;
146 fsnotify_destroy_inode_mark(mark);
147 } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT)
148 fsnotify_destroy_vfsmount_mark(mark);
152 list_del_init(&mark->g_list);
155 spin_unlock(&mark->lock);
158 list_add(&mark->destroy_list, &destroy_list);
164 * callback to the group function to let it know that this mark
168 group->ops->freeing_mark(mark, group);
174 * still exists the second we drop the mark->lock.
182 if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED))
187 * this mark was simultaneously being freed by inode. If that's the
194 void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask)
196 assert_spin_locked(&mark->lock);
198 mark->mask = mask;
200 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE)
201 fsnotify_set_inode_mark_mask_locked(mark, mask);
204 void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask)
206 assert_spin_locked(&mark->lock);
208 mark->ignored_mask = mask;
212 * Attach an initialized mark to a given group and fs object.
216 int fsnotify_add_mark(struct fsnotify_mark *mark,
227 * mark->lock
231 spin_lock(&mark->lock);
234 mark->flags |= FSNOTIFY_MARK_FLAG_ALIVE;
236 mark->group = group;
237 list_add(&mark->g_list, &group->marks_list);
239 fsnotify_get_mark(mark); /* for i_list and g_list */
242 ret = fsnotify_add_inode_mark(mark, group, inode, allow_dups);
246 ret = fsnotify_add_vfsmount_mark(mark, group, mnt, allow_dups);
256 fsnotify_set_mark_mask_locked(mark, mark->mask);
258 spin_unlock(&mark->lock);
265 mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
266 list_del_init(&mark->g_list);
267 mark->group = NULL;
271 spin_unlock(&mark->lock);
274 list_add(&mark->destroy_list, &destroy_list);
282 * clear any marks in a group in which mark->flags & flags is true
287 struct fsnotify_mark *lmark, *mark;
291 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) {
292 if (mark->flags & flags) {
293 list_add(&mark->free_g_list, &free_list);
294 list_del_init(&mark->g_list);
295 fsnotify_get_mark(mark);
300 list_for_each_entry_safe(mark, lmark, &free_list, free_g_list) {
301 fsnotify_destroy_mark(mark);
302 fsnotify_put_mark(mark);
327 void fsnotify_init_mark(struct fsnotify_mark *mark,
328 void (*free_mark)(struct fsnotify_mark *mark))
330 memset(mark, 0, sizeof(*mark));
331 spin_lock_init(&mark->lock);
332 atomic_set(&mark->refcnt, 1);
333 mark->free_mark = free_mark;
338 struct fsnotify_mark *mark, *next;
349 list_for_each_entry_safe(mark, next, &private_destroy_list, destroy_list) {
350 list_del_init(&mark->destroy_list);
351 fsnotify_put_mark(mark);
367 panic("unable to start fsnotify mark destruction thread.");