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, \
44 void lockref_get(struct lockref *lockref) in lockref_get() argument
52 spin_lock(&lockref->lock); in lockref_get()
53 lockref->count++; in lockref_get()
54 spin_unlock(&lockref->lock); in lockref_get()
63 int lockref_get_not_zero(struct lockref *lockref) in lockref_get_not_zero() argument
75 spin_lock(&lockref->lock); in lockref_get_not_zero()
77 if (lockref->count > 0) { in lockref_get_not_zero()
78 lockref->count++; in lockref_get_not_zero()
81 spin_unlock(&lockref->lock); in lockref_get_not_zero()
91 int lockref_put_not_zero(struct lockref *lockref) in lockref_put_not_zero() argument
103 spin_lock(&lockref->lock); in lockref_put_not_zero()
105 if (lockref->count > 1) { in lockref_put_not_zero()
106 lockref->count--; in lockref_put_not_zero()
109 spin_unlock(&lockref->lock); in lockref_put_not_zero()
120 int lockref_get_or_lock(struct lockref *lockref) in lockref_get_or_lock() argument
130 spin_lock(&lockref->lock); in lockref_get_or_lock()
131 if (lockref->count <= 0) in lockref_get_or_lock()
133 lockref->count++; in lockref_get_or_lock()
134 spin_unlock(&lockref->lock); in lockref_get_or_lock()
146 int lockref_put_return(struct lockref *lockref) in lockref_put_return() argument
164 int lockref_put_or_lock(struct lockref *lockref) in lockref_put_or_lock() argument
174 spin_lock(&lockref->lock); in lockref_put_or_lock()
175 if (lockref->count <= 1) in lockref_put_or_lock()
177 lockref->count--; in lockref_put_or_lock()
178 spin_unlock(&lockref->lock); in lockref_put_or_lock()
187 void lockref_mark_dead(struct lockref *lockref) in lockref_mark_dead() argument
189 assert_spin_locked(&lockref->lock); in lockref_mark_dead()
190 lockref->count = -128; in lockref_mark_dead()
199 int lockref_get_not_dead(struct lockref *lockref) in lockref_get_not_dead() argument
211 spin_lock(&lockref->lock); in lockref_get_not_dead()
213 if (lockref->count >= 0) { in lockref_get_not_dead()
214 lockref->count++; in lockref_get_not_dead()
217 spin_unlock(&lockref->lock); in lockref_get_not_dead()