Lines Matching +full:1 +full:l
13 struct nocow_lock_bucket *l = bucket_nocow_lock(t, dev_bucket); in bch2_bucket_nocow_is_locked() local
16 for (i = 0; i < ARRAY_SIZE(l->b); i++) in bch2_bucket_nocow_is_locked()
17 if (l->b[i] == dev_bucket && atomic_read(&l->l[i])) in bch2_bucket_nocow_is_locked()
22 #define sign(v) (v < 0 ? -1 : v > 0 ? 1 : 0)
27 struct nocow_lock_bucket *l = bucket_nocow_lock(t, dev_bucket); in bch2_bucket_nocow_unlock() local
28 int lock_val = flags ? 1 : -1; in bch2_bucket_nocow_unlock()
31 for (i = 0; i < ARRAY_SIZE(l->b); i++) in bch2_bucket_nocow_unlock()
32 if (l->b[i] == dev_bucket) { in bch2_bucket_nocow_unlock()
33 int v = atomic_sub_return(lock_val, &l->l[i]); in bch2_bucket_nocow_unlock()
37 closure_wake_up(&l->wait); in bch2_bucket_nocow_unlock()
44 bool __bch2_bucket_nocow_trylock(struct nocow_lock_bucket *l, in __bch2_bucket_nocow_trylock() argument
47 int v, lock_val = flags ? 1 : -1; in __bch2_bucket_nocow_trylock()
50 spin_lock(&l->lock); in __bch2_bucket_nocow_trylock()
52 for (i = 0; i < ARRAY_SIZE(l->b); i++) in __bch2_bucket_nocow_trylock()
53 if (l->b[i] == dev_bucket) in __bch2_bucket_nocow_trylock()
56 for (i = 0; i < ARRAY_SIZE(l->b); i++) in __bch2_bucket_nocow_trylock()
57 if (!atomic_read(&l->l[i])) { in __bch2_bucket_nocow_trylock()
58 l->b[i] = dev_bucket; in __bch2_bucket_nocow_trylock()
62 spin_unlock(&l->lock); in __bch2_bucket_nocow_trylock()
65 v = atomic_read(&l->l[i]); in __bch2_bucket_nocow_trylock()
69 v = atomic_read(&l->l[i]); in __bch2_bucket_nocow_trylock()
74 atomic_add(lock_val, &l->l[i]); in __bch2_bucket_nocow_trylock()
75 spin_unlock(&l->lock); in __bch2_bucket_nocow_trylock()
80 struct nocow_lock_bucket *l, in __bch2_bucket_nocow_lock() argument
83 if (!__bch2_bucket_nocow_trylock(l, dev_bucket, flags)) { in __bch2_bucket_nocow_lock()
87 __closure_wait_event(&l->wait, __bch2_bucket_nocow_trylock(l, dev_bucket, flags)); in __bch2_bucket_nocow_lock()
96 struct nocow_lock_bucket *l; in bch2_nocow_locks_to_text() local
98 for (l = t->l; l < t->l + ARRAY_SIZE(t->l); l++) { in bch2_nocow_locks_to_text()
101 for (i = 0; i < ARRAY_SIZE(l->l); i++) in bch2_nocow_locks_to_text()
102 v |= atomic_read(&l->l[i]); in bch2_nocow_locks_to_text()
113 for (i = 0; i < ARRAY_SIZE(l->l); i++) { in bch2_nocow_locks_to_text()
114 int v = atomic_read(&l->l[i]); in bch2_nocow_locks_to_text()
116 bch2_bpos_to_text(out, u64_to_bucket(l->b[i])); in bch2_nocow_locks_to_text()
131 for (struct nocow_lock_bucket *l = t->l; l < t->l + ARRAY_SIZE(t->l); l++) in bch2_fs_nocow_locking_exit() local
132 for (unsigned j = 0; j < ARRAY_SIZE(l->l); j++) in bch2_fs_nocow_locking_exit()
133 BUG_ON(atomic_read(&l->l[j])); in bch2_fs_nocow_locking_exit()
140 for (struct nocow_lock_bucket *l = t->l; l < t->l + ARRAY_SIZE(t->l); l++) in bch2_fs_nocow_locking_init() local
141 spin_lock_init(&l->lock); in bch2_fs_nocow_locking_init()