Lines Matching refs:mark
99 void fsnotify_get_mark(struct fsnotify_mark *mark) in fsnotify_get_mark() argument
101 atomic_inc(&mark->refcnt); in fsnotify_get_mark()
104 void fsnotify_put_mark(struct fsnotify_mark *mark) in fsnotify_put_mark() argument
106 if (atomic_dec_and_test(&mark->refcnt)) { in fsnotify_put_mark()
107 if (mark->group) in fsnotify_put_mark()
108 fsnotify_put_group(mark->group); in fsnotify_put_mark()
109 mark->free_mark(mark); in fsnotify_put_mark()
117 struct fsnotify_mark *mark; in fsnotify_recalc_mask() local
119 hlist_for_each_entry(mark, head, obj_list) in fsnotify_recalc_mask()
120 new_mask |= mark->mask; in fsnotify_recalc_mask()
130 void fsnotify_detach_mark(struct fsnotify_mark *mark) in fsnotify_detach_mark() argument
133 struct fsnotify_group *group = mark->group; in fsnotify_detach_mark()
137 spin_lock(&mark->lock); in fsnotify_detach_mark()
140 if (!(mark->flags & FSNOTIFY_MARK_FLAG_ATTACHED)) { in fsnotify_detach_mark()
141 spin_unlock(&mark->lock); in fsnotify_detach_mark()
145 mark->flags &= ~FSNOTIFY_MARK_FLAG_ATTACHED; in fsnotify_detach_mark()
147 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) { in fsnotify_detach_mark()
148 inode = mark->inode; in fsnotify_detach_mark()
149 fsnotify_destroy_inode_mark(mark); in fsnotify_detach_mark()
150 } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) in fsnotify_detach_mark()
151 fsnotify_destroy_vfsmount_mark(mark); in fsnotify_detach_mark()
161 list_del_init(&mark->g_list); in fsnotify_detach_mark()
163 spin_unlock(&mark->lock); in fsnotify_detach_mark()
165 if (inode && (mark->flags & FSNOTIFY_MARK_FLAG_OBJECT_PINNED)) in fsnotify_detach_mark()
176 void fsnotify_free_mark(struct fsnotify_mark *mark) in fsnotify_free_mark() argument
178 struct fsnotify_group *group = mark->group; in fsnotify_free_mark()
180 spin_lock(&mark->lock); in fsnotify_free_mark()
182 if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE)) { in fsnotify_free_mark()
183 spin_unlock(&mark->lock); in fsnotify_free_mark()
186 mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE; in fsnotify_free_mark()
187 spin_unlock(&mark->lock); in fsnotify_free_mark()
190 list_add(&mark->g_list, &destroy_list); in fsnotify_free_mark()
200 group->ops->freeing_mark(mark, group); in fsnotify_free_mark()
203 void fsnotify_destroy_mark(struct fsnotify_mark *mark, in fsnotify_destroy_mark() argument
207 fsnotify_detach_mark(mark); in fsnotify_destroy_mark()
209 fsnotify_free_mark(mark); in fsnotify_destroy_mark()
214 struct fsnotify_mark *mark; in fsnotify_destroy_marks() local
229 mark = hlist_entry(head->first, struct fsnotify_mark, obj_list); in fsnotify_destroy_marks()
235 hlist_del_init_rcu(&mark->obj_list); in fsnotify_destroy_marks()
236 fsnotify_get_mark(mark); in fsnotify_destroy_marks()
238 fsnotify_destroy_mark(mark, mark->group); in fsnotify_destroy_marks()
239 fsnotify_put_mark(mark); in fsnotify_destroy_marks()
243 void fsnotify_set_mark_mask_locked(struct fsnotify_mark *mark, __u32 mask) in fsnotify_set_mark_mask_locked() argument
245 assert_spin_locked(&mark->lock); in fsnotify_set_mark_mask_locked()
247 mark->mask = mask; in fsnotify_set_mark_mask_locked()
249 if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) in fsnotify_set_mark_mask_locked()
250 fsnotify_set_inode_mark_mask_locked(mark, mask); in fsnotify_set_mark_mask_locked()
253 void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mask) in fsnotify_set_mark_ignored_mask_locked() argument
255 assert_spin_locked(&mark->lock); in fsnotify_set_mark_ignored_mask_locked()
257 mark->ignored_mask = mask; in fsnotify_set_mark_ignored_mask_locked()
297 int fsnotify_add_mark_list(struct hlist_head *head, struct fsnotify_mark *mark, in fsnotify_add_mark_list() argument
305 hlist_add_head_rcu(&mark->obj_list, head); in fsnotify_add_mark_list()
313 if ((lmark->group == mark->group) && !allow_dups) in fsnotify_add_mark_list()
316 cmp = fsnotify_compare_groups(lmark->group, mark->group); in fsnotify_add_mark_list()
318 hlist_add_before_rcu(&mark->obj_list, &lmark->obj_list); in fsnotify_add_mark_list()
325 hlist_add_behind_rcu(&mark->obj_list, &last->obj_list); in fsnotify_add_mark_list()
334 int fsnotify_add_mark_locked(struct fsnotify_mark *mark, in fsnotify_add_mark_locked() argument
350 spin_lock(&mark->lock); in fsnotify_add_mark_locked()
351 mark->flags |= FSNOTIFY_MARK_FLAG_ALIVE | FSNOTIFY_MARK_FLAG_ATTACHED; in fsnotify_add_mark_locked()
354 mark->group = group; in fsnotify_add_mark_locked()
355 list_add(&mark->g_list, &group->marks_list); in fsnotify_add_mark_locked()
357 fsnotify_get_mark(mark); /* for i_list and g_list */ in fsnotify_add_mark_locked()
360 ret = fsnotify_add_inode_mark(mark, group, inode, allow_dups); in fsnotify_add_mark_locked()
364 ret = fsnotify_add_vfsmount_mark(mark, group, mnt, allow_dups); in fsnotify_add_mark_locked()
372 fsnotify_set_mark_mask_locked(mark, mark->mask); in fsnotify_add_mark_locked()
373 spin_unlock(&mark->lock); in fsnotify_add_mark_locked()
380 mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE; in fsnotify_add_mark_locked()
381 list_del_init(&mark->g_list); in fsnotify_add_mark_locked()
383 mark->group = NULL; in fsnotify_add_mark_locked()
386 spin_unlock(&mark->lock); in fsnotify_add_mark_locked()
389 list_add(&mark->g_list, &destroy_list); in fsnotify_add_mark_locked()
396 int fsnotify_add_mark(struct fsnotify_mark *mark, struct fsnotify_group *group, in fsnotify_add_mark() argument
401 ret = fsnotify_add_mark_locked(mark, group, inode, mnt, allow_dups); in fsnotify_add_mark()
413 struct fsnotify_mark *mark; in fsnotify_find_mark() local
415 hlist_for_each_entry(mark, head, obj_list) { in fsnotify_find_mark()
416 if (mark->group == group) { in fsnotify_find_mark()
417 fsnotify_get_mark(mark); in fsnotify_find_mark()
418 return mark; in fsnotify_find_mark()
430 struct fsnotify_mark *lmark, *mark; in fsnotify_clear_marks_by_group_flags() local
443 list_for_each_entry_safe(mark, lmark, &group->marks_list, g_list) { in fsnotify_clear_marks_by_group_flags()
444 if (mark->flags & flags) in fsnotify_clear_marks_by_group_flags()
445 list_move(&mark->g_list, &to_free); in fsnotify_clear_marks_by_group_flags()
455 mark = list_first_entry(&to_free, struct fsnotify_mark, g_list); in fsnotify_clear_marks_by_group_flags()
456 fsnotify_get_mark(mark); in fsnotify_clear_marks_by_group_flags()
457 fsnotify_detach_mark(mark); in fsnotify_clear_marks_by_group_flags()
459 fsnotify_free_mark(mark); in fsnotify_clear_marks_by_group_flags()
460 fsnotify_put_mark(mark); in fsnotify_clear_marks_by_group_flags()
487 void fsnotify_init_mark(struct fsnotify_mark *mark, in fsnotify_init_mark() argument
488 void (*free_mark)(struct fsnotify_mark *mark)) in fsnotify_init_mark() argument
490 memset(mark, 0, sizeof(*mark)); in fsnotify_init_mark()
491 spin_lock_init(&mark->lock); in fsnotify_init_mark()
492 atomic_set(&mark->refcnt, 1); in fsnotify_init_mark()
493 mark->free_mark = free_mark; in fsnotify_init_mark()
498 struct fsnotify_mark *mark, *next; in fsnotify_mark_destroy() local
509 list_for_each_entry_safe(mark, next, &private_destroy_list, g_list) { in fsnotify_mark_destroy()
510 list_del_init(&mark->g_list); in fsnotify_mark_destroy()
511 fsnotify_put_mark(mark); in fsnotify_mark_destroy()