Lines Matching refs:bc
44 int _blockcount_sleep(blockcount_t *bc, struct lock_object *, const char *wmesg,
46 void _blockcount_wakeup(blockcount_t *bc, u_int old);
49 blockcount_init(blockcount_t *bc) in blockcount_init() argument
51 atomic_store_int(&bc->__count, 0); in blockcount_init()
55 blockcount_acquire(blockcount_t *bc, u_int n) in blockcount_acquire() argument
60 old = atomic_fetchadd_int(&bc->__count, n); in blockcount_acquire()
61 KASSERT(old + n > old, ("%s: counter overflow %p", __func__, bc)); in blockcount_acquire()
63 atomic_add_int(&bc->__count, n); in blockcount_acquire()
68 blockcount_release(blockcount_t *bc, u_int n) in blockcount_release() argument
73 old = atomic_fetchadd_int(&bc->__count, -n); in blockcount_release()
74 KASSERT(old >= n, ("%s: counter underflow %p", __func__, bc)); in blockcount_release()
76 _blockcount_wakeup(bc, old); in blockcount_release()
80 _blockcount_wait(blockcount_t *bc, struct lock_object *lo, const char *wmesg, in _blockcount_wait() argument
85 while (_blockcount_sleep(bc, lo, wmesg, prio) == EAGAIN) in _blockcount_wait()
89 #define blockcount_sleep(bc, lo, wmesg, prio) \ argument
90 _blockcount_sleep((bc), (struct lock_object *)(lo), (wmesg), (prio))
91 #define blockcount_wait(bc, lo, wmesg, prio) \ argument
92 _blockcount_wait((bc), (struct lock_object *)(lo), (wmesg), (prio))