Lines Matching refs:dir

32 ref_tracker_get_stats(struct ref_tracker_dir *dir, unsigned int limit)  in ref_tracker_get_stats()  argument
44 list_for_each_entry(tracker, &dir->list, head) { in ref_tracker_get_stats()
84 __ref_tracker_dir_pr_ostream(struct ref_tracker_dir *dir, in __ref_tracker_dir_pr_ostream() argument
92 lockdep_assert_held(&dir->lock); in __ref_tracker_dir_pr_ostream()
94 if (list_empty(&dir->list)) in __ref_tracker_dir_pr_ostream()
97 stats = ref_tracker_get_stats(dir, display_limit); in __ref_tracker_dir_pr_ostream()
100 dir->name, dir, stats); in __ref_tracker_dir_pr_ostream()
110 pr_ostream(s, "%s@%pK has %d/%d users at\n%s\n", dir->name, dir, in __ref_tracker_dir_pr_ostream()
117 dir->name, dir, skipped, stats->total); in __ref_tracker_dir_pr_ostream()
124 void ref_tracker_dir_print_locked(struct ref_tracker_dir *dir, in ref_tracker_dir_print_locked() argument
129 __ref_tracker_dir_pr_ostream(dir, display_limit, &os); in ref_tracker_dir_print_locked()
133 void ref_tracker_dir_print(struct ref_tracker_dir *dir, in ref_tracker_dir_print() argument
138 spin_lock_irqsave(&dir->lock, flags); in ref_tracker_dir_print()
139 ref_tracker_dir_print_locked(dir, display_limit); in ref_tracker_dir_print()
140 spin_unlock_irqrestore(&dir->lock, flags); in ref_tracker_dir_print()
144 int ref_tracker_dir_snprint(struct ref_tracker_dir *dir, char *buf, size_t size) in ref_tracker_dir_snprint() argument
149 spin_lock_irqsave(&dir->lock, flags); in ref_tracker_dir_snprint()
150 __ref_tracker_dir_pr_ostream(dir, 16, &os); in ref_tracker_dir_snprint()
151 spin_unlock_irqrestore(&dir->lock, flags); in ref_tracker_dir_snprint()
157 void ref_tracker_dir_exit(struct ref_tracker_dir *dir) in ref_tracker_dir_exit() argument
163 dir->dead = true; in ref_tracker_dir_exit()
164 spin_lock_irqsave(&dir->lock, flags); in ref_tracker_dir_exit()
165 list_for_each_entry_safe(tracker, n, &dir->quarantine, head) { in ref_tracker_dir_exit()
168 dir->quarantine_avail++; in ref_tracker_dir_exit()
170 if (!list_empty(&dir->list)) { in ref_tracker_dir_exit()
171 ref_tracker_dir_print_locked(dir, 16); in ref_tracker_dir_exit()
173 list_for_each_entry_safe(tracker, n, &dir->list, head) { in ref_tracker_dir_exit()
178 spin_unlock_irqrestore(&dir->lock, flags); in ref_tracker_dir_exit()
180 WARN_ON_ONCE(refcount_read(&dir->untracked) != 1); in ref_tracker_dir_exit()
181 WARN_ON_ONCE(refcount_read(&dir->no_tracker) != 1); in ref_tracker_dir_exit()
185 int ref_tracker_alloc(struct ref_tracker_dir *dir, in ref_tracker_alloc() argument
195 WARN_ON_ONCE(dir->dead); in ref_tracker_alloc()
198 refcount_inc(&dir->no_tracker); in ref_tracker_alloc()
206 refcount_inc(&dir->untracked); in ref_tracker_alloc()
212 spin_lock_irqsave(&dir->lock, flags); in ref_tracker_alloc()
213 list_add(&tracker->head, &dir->list); in ref_tracker_alloc()
214 spin_unlock_irqrestore(&dir->lock, flags); in ref_tracker_alloc()
219 int ref_tracker_free(struct ref_tracker_dir *dir, in ref_tracker_free() argument
228 WARN_ON_ONCE(dir->dead); in ref_tracker_free()
231 refcount_dec(&dir->no_tracker); in ref_tracker_free()
236 refcount_dec(&dir->untracked); in ref_tracker_free()
243 spin_lock_irqsave(&dir->lock, flags); in ref_tracker_free()
254 spin_unlock_irqrestore(&dir->lock, flags); in ref_tracker_free()
262 list_move_tail(&tracker->head, &dir->quarantine); in ref_tracker_free()
263 if (!dir->quarantine_avail) { in ref_tracker_free()
264 tracker = list_first_entry(&dir->quarantine, struct ref_tracker, head); in ref_tracker_free()
267 dir->quarantine_avail--; in ref_tracker_free()
270 spin_unlock_irqrestore(&dir->lock, flags); in ref_tracker_free()