Lines Matching refs:slot

77 	unsigned int slot;
106 for (slot = 0; slot < num_slots; slot++) {
107 profile->slots[slot].profile = profile;
108 list_add_tail(&profile->slots[slot].idle_slot_node,
179 blk_crypto_remove_slot_from_lru_list(struct blk_crypto_keyslot *slot)
181 struct blk_crypto_profile *profile = slot->profile;
185 list_del(&slot->idle_slot_node);
208 struct blk_crypto_keyslot *slot;
210 slot = blk_crypto_find_keyslot(profile, key);
211 if (!slot)
213 if (atomic_inc_return(&slot->slot_refs) == 1) {
214 /* Took first reference to this slot; remove it from LRU list */
215 blk_crypto_remove_slot_from_lru_list(slot);
217 return slot;
222 * @slot: a keyslot that blk_crypto_get_keyslot() returned
226 unsigned int blk_crypto_keyslot_index(struct blk_crypto_keyslot *slot)
228 return slot - slot->profile->slots;
241 * the specified key. If the key is already in a slot, this reuses it;
242 * otherwise this waits for a slot to become idle and programs the key into it.
252 struct blk_crypto_keyslot *slot;
266 slot = blk_crypto_find_and_grab_keyslot(profile, key);
268 if (slot)
273 slot = blk_crypto_find_and_grab_keyslot(profile, key);
274 if (slot) {
280 * If we're here, that means there wasn't a slot that was
291 slot = list_first_entry(&profile->idle_slots, struct blk_crypto_keyslot,
293 slot_idx = blk_crypto_keyslot_index(slot);
302 /* Move this slot to the hash list for the new key. */
303 if (slot->key)
304 hlist_del(&slot->hash_node);
305 slot->key = key;
306 hlist_add_head(&slot->hash_node,
309 atomic_set(&slot->slot_refs, 1);
311 blk_crypto_remove_slot_from_lru_list(slot);
315 *slot_ptr = slot;
321 * @slot: The keyslot to release the reference of
325 void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot)
327 struct blk_crypto_profile *profile = slot->profile;
330 if (atomic_dec_and_lock_irqsave(&slot->slot_refs,
332 list_add_tail(&slot->idle_slot_node, &profile->idle_slots);
366 struct blk_crypto_keyslot *slot;
380 slot = blk_crypto_find_keyslot(profile, key);
381 if (!slot) {
390 if (WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)) {
396 blk_crypto_keyslot_index(slot));
400 * table and clear slot->key even on error.
402 hlist_del(&slot->hash_node);
403 slot->key = NULL;
420 unsigned int slot;
427 for (slot = 0; slot < profile->num_slots; slot++) {
428 const struct blk_crypto_key *key = profile->slots[slot].key;
434 err = profile->ll_ops.keyslot_program(profile, key, slot);