Lines Matching refs:lockref
13 struct lockref old; \
15 old.lock_count = READ_ONCE(lockref->lock_count); \
17 struct lockref new = old, prev = old; \
19 old.lock_count = cmpxchg64_relaxed(&lockref->lock_count, \
43 void lockref_get(struct lockref *lockref) in lockref_get() argument
51 spin_lock(&lockref->lock); in lockref_get()
52 lockref->count++; in lockref_get()
53 spin_unlock(&lockref->lock); in lockref_get()
62 int lockref_get_not_zero(struct lockref *lockref) in lockref_get_not_zero() argument
74 spin_lock(&lockref->lock); in lockref_get_not_zero()
76 if (lockref->count > 0) { in lockref_get_not_zero()
77 lockref->count++; in lockref_get_not_zero()
80 spin_unlock(&lockref->lock); in lockref_get_not_zero()
90 int lockref_put_not_zero(struct lockref *lockref) in lockref_put_not_zero() argument
102 spin_lock(&lockref->lock); in lockref_put_not_zero()
104 if (lockref->count > 1) { in lockref_put_not_zero()
105 lockref->count--; in lockref_put_not_zero()
108 spin_unlock(&lockref->lock); in lockref_put_not_zero()
119 int lockref_get_or_lock(struct lockref *lockref) in lockref_get_or_lock() argument
129 spin_lock(&lockref->lock); in lockref_get_or_lock()
130 if (lockref->count <= 0) in lockref_get_or_lock()
132 lockref->count++; in lockref_get_or_lock()
133 spin_unlock(&lockref->lock); in lockref_get_or_lock()
145 int lockref_put_return(struct lockref *lockref) in lockref_put_return() argument
163 int lockref_put_or_lock(struct lockref *lockref) in lockref_put_or_lock() argument
173 spin_lock(&lockref->lock); in lockref_put_or_lock()
174 if (lockref->count <= 1) in lockref_put_or_lock()
176 lockref->count--; in lockref_put_or_lock()
177 spin_unlock(&lockref->lock); in lockref_put_or_lock()
186 void lockref_mark_dead(struct lockref *lockref) in lockref_mark_dead() argument
188 assert_spin_locked(&lockref->lock); in lockref_mark_dead()
189 lockref->count = -128; in lockref_mark_dead()
198 int lockref_get_not_dead(struct lockref *lockref) in lockref_get_not_dead() argument
210 spin_lock(&lockref->lock); in lockref_get_not_dead()
212 if (lockref->count >= 0) { in lockref_get_not_dead()
213 lockref->count++; in lockref_get_not_dead()
216 spin_unlock(&lockref->lock); in lockref_get_not_dead()