Lines Matching refs:bc
42 int _blockcount_sleep(blockcount_t *bc, struct lock_object *, const char *wmesg,
44 void _blockcount_wakeup(blockcount_t *bc, u_int old);
47 blockcount_init(blockcount_t *bc) in blockcount_init() argument
49 atomic_store_int(&bc->__count, 0); in blockcount_init()
53 blockcount_acquire(blockcount_t *bc, u_int n) in blockcount_acquire() argument
58 old = atomic_fetchadd_int(&bc->__count, n); in blockcount_acquire()
59 KASSERT(old + n > old, ("%s: counter overflow %p", __func__, bc)); in blockcount_acquire()
61 atomic_add_int(&bc->__count, n); in blockcount_acquire()
66 blockcount_release(blockcount_t *bc, u_int n) in blockcount_release() argument
71 old = atomic_fetchadd_int(&bc->__count, -n); in blockcount_release()
72 KASSERT(old >= n, ("%s: counter underflow %p", __func__, bc)); in blockcount_release()
74 _blockcount_wakeup(bc, old); in blockcount_release()
78 _blockcount_wait(blockcount_t *bc, struct lock_object *lo, const char *wmesg, in _blockcount_wait() argument
83 while (_blockcount_sleep(bc, lo, wmesg, prio) == EAGAIN) in _blockcount_wait()
87 #define blockcount_sleep(bc, lo, wmesg, prio) \ argument
88 _blockcount_sleep((bc), (struct lock_object *)(lo), (wmesg), (prio))
89 #define blockcount_wait(bc, lo, wmesg, prio) \ argument
90 _blockcount_wait((bc), (struct lock_object *)(lo), (wmesg), (prio))