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
61 lock_ref, in lockref_inc_not_zero()
70 spin_lock(&lock_ref->lock); in lockref_inc_not_zero()
72 if (lock_ref->count > 0) in lockref_inc_not_zero()
74 ++lock_ref->count; in lockref_inc_not_zero()
77 spin_unlock(&lock_ref->lock); in lockref_inc_not_zero()
91 int lockref_dec(struct lockref *lock_ref) in lockref_dec() argument
94 lock_ref, in lockref_dec()
104 spin_lock(&lock_ref->lock); in lockref_dec()
105 if (lock_ref->count > 0) in lockref_dec()
107 --lock_ref->count; in lockref_dec()
108 retval = lock_ref->count; in lockref_dec()
110 spin_unlock(&lock_ref->lock); in lockref_dec()
125 int lockref_dec_return(struct lockref *lock_ref) in lockref_dec_return() argument
128 lock_ref, in lockref_dec_return()
149 bool lockref_dec_not_zero(struct lockref *lock_ref) in lockref_dec_not_zero() argument
152 lock_ref, in lockref_dec_not_zero()
161 spin_lock(&lock_ref->lock); in lockref_dec_not_zero()
162 if (lock_ref->count > 1) in lockref_dec_not_zero()
164 --lock_ref->count; in lockref_dec_not_zero()
167 spin_unlock(&lock_ref->lock); in lockref_dec_not_zero()
181 bool lockref_dec_or_lock_not_zero(struct lockref *lock_ref) in lockref_dec_or_lock_not_zero() argument
184 lock_ref, in lockref_dec_or_lock_not_zero()
193 spin_lock(&lock_ref->lock); in lockref_dec_or_lock_not_zero()
194 if (lock_ref->count > 1) in lockref_dec_or_lock_not_zero()
196 --lock_ref->count; in lockref_dec_or_lock_not_zero()
199 spin_unlock(&lock_ref->lock); in lockref_dec_or_lock_not_zero()
208 void lockref_mark_dead(struct lockref *lock_ref) in lockref_mark_dead() argument
211 assert_spin_locked(&lock_ref->lock); in lockref_mark_dead()
212 lock_ref->count = -128; in lockref_mark_dead()
222 bool lockref_inc_not_dead(struct lockref *lock_ref) in lockref_inc_not_dead() argument
225 lock_ref, in lockref_inc_not_dead()
235 spin_lock(&lock_ref->lock); in lockref_inc_not_dead()
236 if (lock_ref->count >= 0) in lockref_inc_not_dead()
238 ++lock_ref->count; in lockref_inc_not_dead()
241 spin_unlock(&lock_ref->lock); in lockref_inc_not_dead()