Lines Matching refs:permits
57 struct afs_permits *permits = in afs_permits_rcu() local
61 for (i = 0; i < permits->nr_permits; i++) in afs_permits_rcu()
62 key_put(permits->permits[i].key); in afs_permits_rcu()
63 kfree(permits); in afs_permits_rcu()
69 void afs_put_permits(struct afs_permits *permits) in afs_put_permits() argument
71 if (permits && refcount_dec_and_test(&permits->usage)) { in afs_put_permits()
73 hash_del_rcu(&permits->hash_node); in afs_put_permits()
75 call_rcu(&permits->rcu, afs_permits_rcu); in afs_put_permits()
84 struct afs_permits *permits; in afs_clear_permits() local
87 permits = rcu_dereference_protected(vnode->permit_cache, in afs_clear_permits()
92 afs_put_permits(permits); in afs_clear_permits()
99 static void afs_hash_permits(struct afs_permits *permits) in afs_hash_permits() argument
101 unsigned long h = permits->nr_permits; in afs_hash_permits()
104 for (i = 0; i < permits->nr_permits; i++) { in afs_hash_permits()
105 h += (unsigned long)permits->permits[i].key / sizeof(void *); in afs_hash_permits()
106 h += permits->permits[i].access; in afs_hash_permits()
109 permits->h = h; in afs_hash_permits()
121 struct afs_permits *permits, *xpermits, *replacement, *zap, *new = NULL; in afs_cache_permit() local
135 permits = rcu_dereference(vnode->permit_cache); in afs_cache_permit()
136 if (permits) { in afs_cache_permit()
137 if (!permits->invalidated) { in afs_cache_permit()
138 for (i = 0; i < permits->nr_permits; i++) { in afs_cache_permit()
139 if (permits->permits[i].key < key) in afs_cache_permit()
141 if (permits->permits[i].key > key) in afs_cache_permit()
143 if (permits->permits[i].access != caller_access) { in afs_cache_permit()
159 changed |= permits->invalidated; in afs_cache_permit()
160 size = permits->nr_permits; in afs_cache_permit()
167 if (permits != rcu_access_pointer(vnode->permit_cache)) in afs_cache_permit()
172 afs_put_permits(permits); in afs_cache_permit()
173 permits = NULL; in afs_cache_permit()
184 if (permits && !refcount_inc_not_zero(&permits->usage)) in afs_cache_permit()
205 if (permits) { in afs_cache_permit()
206 for (i = 0; i < permits->nr_permits; i++) { in afs_cache_permit()
207 if (j == i && permits->permits[i].key > key) { in afs_cache_permit()
208 new->permits[j].key = key; in afs_cache_permit()
209 new->permits[j].access = caller_access; in afs_cache_permit()
212 new->permits[j].key = permits->permits[i].key; in afs_cache_permit()
213 new->permits[j].access = permits->permits[i].access; in afs_cache_permit()
219 new->permits[j].key = key; in afs_cache_permit()
220 new->permits[j].access = caller_access; in afs_cache_permit()
232 memcmp(xpermits->permits, new->permits, in afs_cache_permit()
245 key_get(new->permits[i].key); in afs_cache_permit()
258 zap == permits) in afs_cache_permit()
265 afs_put_permits(permits); in afs_cache_permit()
286 struct afs_permits *permits; in afs_check_permit() local
300 permits = rcu_dereference(vnode->permit_cache); in afs_check_permit()
301 if (permits) { in afs_check_permit()
302 for (i = 0; i < permits->nr_permits; i++) { in afs_check_permit()
303 if (permits->permits[i].key < key) in afs_check_permit()
305 if (permits->permits[i].key > key) in afs_check_permit()
308 *_access = permits->permits[i].access; in afs_check_permit()
309 valid = !permits->invalidated; in afs_check_permit()