Lines Matching refs:ht
583 static int h_init(struct smq_hash_table *ht, struct entry_space *es, unsigned nr_entries) in h_init() argument
587 ht->es = es; in h_init()
589 ht->hash_bits = __ffs(nr_buckets); in h_init()
591 ht->buckets = vmalloc(array_size(nr_buckets, sizeof(*ht->buckets))); in h_init()
592 if (!ht->buckets) in h_init()
596 ht->buckets[i] = INDEXER_NULL; in h_init()
601 static void h_exit(struct smq_hash_table *ht) in h_exit() argument
603 vfree(ht->buckets); in h_exit()
606 static struct entry *h_head(struct smq_hash_table *ht, unsigned bucket) in h_head() argument
608 return to_entry(ht->es, ht->buckets[bucket]); in h_head()
611 static struct entry *h_next(struct smq_hash_table *ht, struct entry *e) in h_next() argument
613 return to_entry(ht->es, e->hash_next); in h_next()
616 static void __h_insert(struct smq_hash_table *ht, unsigned bucket, struct entry *e) in __h_insert() argument
618 e->hash_next = ht->buckets[bucket]; in __h_insert()
619 ht->buckets[bucket] = to_index(ht->es, e); in __h_insert()
622 static void h_insert(struct smq_hash_table *ht, struct entry *e) in h_insert() argument
624 unsigned h = hash_64(from_oblock(e->oblock), ht->hash_bits); in h_insert()
625 __h_insert(ht, h, e); in h_insert()
628 static struct entry *__h_lookup(struct smq_hash_table *ht, unsigned h, dm_oblock_t oblock, in __h_lookup() argument
634 for (e = h_head(ht, h); e; e = h_next(ht, e)) { in __h_lookup()
644 static void __h_unlink(struct smq_hash_table *ht, unsigned h, in __h_unlink() argument
650 ht->buckets[h] = e->hash_next; in __h_unlink()
656 static struct entry *h_lookup(struct smq_hash_table *ht, dm_oblock_t oblock) in h_lookup() argument
659 unsigned h = hash_64(from_oblock(oblock), ht->hash_bits); in h_lookup()
661 e = __h_lookup(ht, h, oblock, &prev); in h_lookup()
667 __h_unlink(ht, h, e, prev); in h_lookup()
668 __h_insert(ht, h, e); in h_lookup()
674 static void h_remove(struct smq_hash_table *ht, struct entry *e) in h_remove() argument
676 unsigned h = hash_64(from_oblock(e->oblock), ht->hash_bits); in h_remove()
683 e = __h_lookup(ht, h, e->oblock, &prev); in h_remove()
685 __h_unlink(ht, h, e, prev); in h_remove()