Lines Matching refs:lock_ref
40 void lockref_inc(struct lockref *lock_ref) in lockref_inc() argument
43 CMPXCHG_LOOP(lock_ref, ++new.count;, return;); in lockref_inc()
46 spin_lock(&lock_ref->lock); in lockref_inc()
47 ++lock_ref->count; in lockref_inc()
48 spin_unlock(&lock_ref->lock); in lockref_inc()
58 bool lockref_inc_not_zero(struct lockref *lock_ref) in lockref_inc_not_zero() argument
60 CMPXCHG_LOOP(lock_ref, in lockref_inc_not_zero()
66 spin_lock(&lock_ref->lock); in lockref_inc_not_zero()
68 if (lock_ref->count > 0) in lockref_inc_not_zero()
70 ++lock_ref->count; in lockref_inc_not_zero()
73 spin_unlock(&lock_ref->lock); in lockref_inc_not_zero()
87 int lockref_dec(struct lockref *lock_ref) in lockref_dec() argument
89 CMPXCHG_LOOP(lock_ref, in lockref_dec()
97 spin_lock(&lock_ref->lock); in lockref_dec()
98 if (lock_ref->count > 0) in lockref_dec()
100 --lock_ref->count; in lockref_dec()
101 retval = lock_ref->count; in lockref_dec()
103 spin_unlock(&lock_ref->lock); in lockref_dec()
118 int lockref_dec_return(struct lockref *lock_ref) in lockref_dec_return() argument
120 CMPXCHG_LOOP(lock_ref, in lockref_dec_return()
139 bool lockref_dec_not_zero(struct lockref *lock_ref) in lockref_dec_not_zero() argument
141 CMPXCHG_LOOP(lock_ref, in lockref_dec_not_zero()
148 spin_lock(&lock_ref->lock); in lockref_dec_not_zero()
149 if (lock_ref->count > 1) in lockref_dec_not_zero()
151 --lock_ref->count; in lockref_dec_not_zero()
154 spin_unlock(&lock_ref->lock); in lockref_dec_not_zero()
168 bool lockref_dec_or_lock_not_zero(struct lockref *lock_ref) in lockref_dec_or_lock_not_zero() argument
170 CMPXCHG_LOOP(lock_ref, in lockref_dec_or_lock_not_zero()
177 spin_lock(&lock_ref->lock); in lockref_dec_or_lock_not_zero()
178 if (lock_ref->count > 1) in lockref_dec_or_lock_not_zero()
180 --lock_ref->count; in lockref_dec_or_lock_not_zero()
183 spin_unlock(&lock_ref->lock); in lockref_dec_or_lock_not_zero()
192 void lockref_mark_dead(struct lockref *lock_ref) in lockref_mark_dead() argument
195 assert_spin_locked(&lock_ref->lock); in lockref_mark_dead()
196 lock_ref->count = -128; in lockref_mark_dead()
206 bool lockref_inc_not_dead(struct lockref *lock_ref) in lockref_inc_not_dead() argument
208 CMPXCHG_LOOP(lock_ref, in lockref_inc_not_dead()
216 spin_lock(&lock_ref->lock); in lockref_inc_not_dead()
217 if (lock_ref->count >= 0) in lockref_inc_not_dead()
219 ++lock_ref->count; in lockref_inc_not_dead()
222 spin_unlock(&lock_ref->lock); in lockref_inc_not_dead()