• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/sys/contrib/openzfs/module/zfs/

Lines Matching defs:rc

59 zfs_refcount_create(zfs_refcount_t *rc)
61 mutex_init(&rc->rc_mtx, NULL, MUTEX_DEFAULT, NULL);
62 list_create(&rc->rc_list, sizeof (reference_t),
64 list_create(&rc->rc_removed, sizeof (reference_t),
66 rc->rc_count = 0;
67 rc->rc_removed_count = 0;
68 rc->rc_tracked = reference_tracking_enable;
72 zfs_refcount_create_tracked(zfs_refcount_t *rc)
74 zfs_refcount_create(rc);
75 rc->rc_tracked = B_TRUE;
79 zfs_refcount_create_untracked(zfs_refcount_t *rc)
81 zfs_refcount_create(rc);
82 rc->rc_tracked = B_FALSE;
86 zfs_refcount_destroy_many(zfs_refcount_t *rc, uint64_t number)
90 ASSERT3U(rc->rc_count, ==, number);
91 while ((ref = list_head(&rc->rc_list))) {
92 list_remove(&rc->rc_list, ref);
95 list_destroy(&rc->rc_list);
97 while ((ref = list_head(&rc->rc_removed))) {
98 list_remove(&rc->rc_removed, ref);
102 list_destroy(&rc->rc_removed);
103 mutex_destroy(&rc->rc_mtx);
107 zfs_refcount_destroy(zfs_refcount_t *rc)
109 zfs_refcount_destroy_many(rc, 0);
113 zfs_refcount_is_zero(zfs_refcount_t *rc)
115 return (rc->rc_count == 0);
119 zfs_refcount_count(zfs_refcount_t *rc)
121 return (rc->rc_count);
125 zfs_refcount_add_many(zfs_refcount_t *rc, uint64_t number, const void *holder)
130 if (rc->rc_tracked) {
135 mutex_enter(&rc->rc_mtx);
136 ASSERT3U(rc->rc_count, >=, 0);
137 if (rc->rc_tracked)
138 list_insert_head(&rc->rc_list, ref);
139 rc->rc_count += number;
140 count = rc->rc_count;
141 mutex_exit(&rc->rc_mtx);
147 zfs_refcount_add(zfs_refcount_t *rc, const void *holder)
149 return (zfs_refcount_add_many(rc, 1, holder));
153 zfs_refcount_remove_many(zfs_refcount_t *rc, uint64_t number,
159 mutex_enter(&rc->rc_mtx);
160 ASSERT3U(rc->rc_count, >=, number);
162 if (!rc->rc_tracked) {
163 rc->rc_count -= number;
164 count = rc->rc_count;
165 mutex_exit(&rc->rc_mtx);
169 for (ref = list_head(&rc->rc_list); ref;
170 ref = list_next(&rc->rc_list, ref)) {
172 list_remove(&rc->rc_list, ref);
177 list_insert_head(&rc->rc_removed, ref);
178 rc->rc_removed_count++;
179 if (rc->rc_removed_count > reference_history) {
180 ref = list_tail(&rc->rc_removed);
181 list_remove(&rc->rc_removed, ref);
185 rc->rc_removed_count--;
190 rc->rc_count -= number;
191 count = rc->rc_count;
192 mutex_exit(&rc->rc_mtx);
197 (u_longlong_t)(uintptr_t)rc);
202 zfs_refcount_remove(zfs_refcount_t *rc, const void *holder)
204 return (zfs_refcount_remove_many(rc, 1, holder));
239 zfs_refcount_transfer_ownership_many(zfs_refcount_t *rc, uint64_t number,
245 mutex_enter(&rc->rc_mtx);
246 if (!rc->rc_tracked) {
247 mutex_exit(&rc->rc_mtx);
251 for (ref = list_head(&rc->rc_list); ref;
252 ref = list_next(&rc->rc_list, ref)) {
261 mutex_exit(&rc->rc_mtx);
265 zfs_refcount_transfer_ownership(zfs_refcount_t *rc, const void *current_holder,
268 return (zfs_refcount_transfer_ownership_many(rc, 1, current_holder,
278 zfs_refcount_held(zfs_refcount_t *rc, const void *holder)
282 mutex_enter(&rc->rc_mtx);
284 if (!rc->rc_tracked) {
285 mutex_exit(&rc->rc_mtx);
286 return (rc->rc_count > 0);
289 for (ref = list_head(&rc->rc_list); ref;
290 ref = list_next(&rc->rc_list, ref)) {
292 mutex_exit(&rc->rc_mtx);
296 mutex_exit(&rc->rc_mtx);
306 zfs_refcount_not_held(zfs_refcount_t *rc, const void *holder)
310 mutex_enter(&rc->rc_mtx);
312 if (!rc->rc_tracked) {
313 mutex_exit(&rc->rc_mtx);
317 for (ref = list_head(&rc->rc_list); ref;
318 ref = list_next(&rc->rc_list, ref)) {
320 mutex_exit(&rc->rc_mtx);
324 mutex_exit(&rc->rc_mtx);