Lines Matching refs:lockref
3 #include <linux/lockref.h>
13 struct lockref old; \
15 old.lock_count = READ_ONCE(lockref->lock_count); \
17 struct lockref new = old; \
19 if (likely(try_cmpxchg64_relaxed(&lockref->lock_count, \
37 * @lockref: pointer to lockref structure
42 void lockref_get(struct lockref *lockref)
50 spin_lock(&lockref->lock);
51 lockref->count++;
52 spin_unlock(&lockref->lock);
58 * @lockref: pointer to lockref structure
61 bool lockref_get_not_zero(struct lockref *lockref)
73 spin_lock(&lockref->lock);
74 if (lockref->count > 0) {
75 lockref->count++;
78 spin_unlock(&lockref->lock);
85 * @lockref: pointer to lockref structure
88 * If the lockref was dead or locked, return -1.
90 int lockref_put_return(struct lockref *lockref)
105 * @lockref: pointer to lockref structure
108 bool lockref_put_or_lock(struct lockref *lockref)
118 spin_lock(&lockref->lock);
119 if (lockref->count <= 1)
121 lockref->count--;
122 spin_unlock(&lockref->lock);
128 * lockref_mark_dead - mark lockref dead
129 * @lockref: pointer to lockref structure
131 void lockref_mark_dead(struct lockref *lockref)
133 assert_spin_locked(&lockref->lock);
134 lockref->count = -128;
140 * @lockref: pointer to lockref structure
141 * Return: 1 if count updated successfully or 0 if lockref was dead
143 bool lockref_get_not_dead(struct lockref *lockref)
155 spin_lock(&lockref->lock);
156 if (lockref->count >= 0) {
157 lockref->count++;
160 spin_unlock(&lockref->lock);