Lines Matching refs:hash

72 	int hash = (sect >> RAID5_STRIPE_SHIFT(conf)) & HASH_MASK;
73 return &conf->stripe_hashtbl[hash];
81 static inline void lock_device_hash_lock(struct r5conf *conf, int hash)
83 spin_lock_irq(conf->hash_locks + hash);
87 static inline void unlock_device_hash_lock(struct r5conf *conf, int hash)
90 spin_unlock_irq(conf->hash_locks + hash);
305 * @hash could be NR_STRIPE_HASH_LOCKS, then we have a list of inactive_list
309 * only takes hash lock.
313 int hash)
319 if (hash == NR_STRIPE_HASH_LOCKS) {
321 hash = NR_STRIPE_HASH_LOCKS - 1;
332 spin_lock_irqsave(conf->hash_locks + hash, flags);
333 if (list_empty(conf->inactive_list + hash) &&
336 list_splice_tail_init(list, conf->inactive_list + hash);
338 spin_unlock_irqrestore(conf->hash_locks + hash, flags);
341 hash--;
364 int hash;
374 hash = sh->hash_lock_index;
375 __release_stripe(conf, sh, &temp_inactive_list[hash]);
387 int hash;
406 hash = sh->hash_lock_index;
409 release_inactive_stripe_list(conf, &list, hash);
418 hlist_del_init(&sh->hash);
428 hlist_add_head(&sh->hash, hp);
432 static struct stripe_head *get_free_stripe(struct r5conf *conf, int hash)
437 if (list_empty(conf->inactive_list + hash))
439 first = (conf->inactive_list + hash)->next;
444 BUG_ON(hash != sh->hash_lock_index);
445 if (list_empty(conf->inactive_list + hash))
613 hlist_for_each_entry(sh, stripe_hash(conf, sector), hash)
707 int hash = stripe_hash_locks_hash(conf, sector);
712 spin_lock_irq(conf->hash_locks + hash);
717 *(conf->hash_locks + hash));
721 sh = get_free_stripe(conf, hash);
737 !list_empty(conf->inactive_list + hash) &&
742 *(conf->hash_locks + hash));
757 if (!list_empty(conf->inactive_list + hash))
760 if (list_empty(conf->inactive_list + hash) && inc_empty_inactive_list_flag)
772 spin_unlock_irq(conf->hash_locks + hash);
820 int hash;
830 hash = stripe_hash_locks_hash(conf, head_sector);
831 spin_lock_irq(conf->hash_locks + hash);
841 if (!list_empty(conf->inactive_list + hash))
844 if (list_empty(conf->inactive_list + hash) && inc_empty_inactive_list_flag)
854 spin_unlock_irq(conf->hash_locks + hash);
2492 int hash, cnt;
2528 hash = 0;
2531 lock_device_hash_lock(conf, hash);
2533 !list_empty(conf->inactive_list + hash),
2534 unlock_device_hash_lock(conf, hash),
2535 lock_device_hash_lock(conf, hash));
2536 osh = get_free_stripe(conf, hash);
2537 unlock_device_hash_lock(conf, hash);
2550 nsh->hash_lock_index = hash;
2554 !!((conf->max_nr_stripes % NR_STRIPE_HASH_LOCKS) > hash)) {
2555 hash++;
2638 int hash = (conf->max_nr_stripes - 1) & STRIPE_HASH_LOCKS_MASK;
2640 spin_lock_irq(conf->hash_locks + hash);
2641 sh = get_free_stripe(conf, hash);
2642 spin_unlock_irq(conf->hash_locks + hash);
4020 int hash;
4031 * no updated data, so remove it from hash list and the stripe
4035 hash = sh->hash_lock_index;
4036 spin_lock_irq(conf->hash_locks + hash);
4038 spin_unlock_irq(conf->hash_locks + hash);
5296 int hash;
5299 hash = sh->hash_lock_index;
5300 __release_stripe(conf, sh, &temp_inactive_list[hash]);
5618 int hash;
5636 hash = sh->hash_lock_index;
5637 __release_stripe(conf, sh, &cb->temp_inactive_list[hash]);
6372 int i, batch_size = 0, hash;
6410 hash = batch[i]->hash_lock_index;
6411 __release_stripe(conf, batch[i], &temp_inactive_list[hash]);
6463 * We scan the hash table for stripes which can be handled now.