Lines Matching defs: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 int lockref_get_not_zero(struct lockref *lockref)
73 spin_lock(&lockref->lock);
75 if (lockref->count > 0) {
76 lockref->count++;
79 spin_unlock(&lockref->lock);
86 * @lockref: pointer to lockref structure
89 int lockref_put_not_zero(struct lockref *lockref)
101 spin_lock(&lockref->lock);
103 if (lockref->count > 1) {
104 lockref->count--;
107 spin_unlock(&lockref->lock);
114 * @lockref: pointer to lockref structure
117 * If the lockref was dead or locked, return an error.
119 int lockref_put_return(struct lockref *lockref)
134 * @lockref: pointer to lockref structure
137 int lockref_put_or_lock(struct lockref *lockref)
147 spin_lock(&lockref->lock);
148 if (lockref->count <= 1)
150 lockref->count--;
151 spin_unlock(&lockref->lock);
157 * lockref_mark_dead - mark lockref dead
158 * @lockref: pointer to lockref structure
160 void lockref_mark_dead(struct lockref *lockref)
162 assert_spin_locked(&lockref->lock);
163 lockref->count = -128;
169 * @lockref: pointer to lockref structure
170 * Return: 1 if count updated successfully or 0 if lockref was dead
172 int lockref_get_not_dead(struct lockref *lockref)
184 spin_lock(&lockref->lock);
186 if (lockref->count >= 0) {
187 lockref->count++;
190 spin_unlock(&lockref->lock);