Lines Matching refs:ht
585 static int h_init(struct smq_hash_table *ht, struct entry_space *es, unsigned int nr_entries) in h_init() argument
589 ht->es = es; in h_init()
591 ht->hash_bits = __ffs(nr_buckets); in h_init()
593 ht->buckets = vmalloc(array_size(nr_buckets, sizeof(*ht->buckets))); in h_init()
594 if (!ht->buckets) in h_init()
598 ht->buckets[i] = INDEXER_NULL; in h_init()
603 static void h_exit(struct smq_hash_table *ht) in h_exit() argument
605 vfree(ht->buckets); in h_exit()
608 static struct entry *h_head(struct smq_hash_table *ht, unsigned int bucket) in h_head() argument
610 return to_entry(ht->es, ht->buckets[bucket]); in h_head()
613 static struct entry *h_next(struct smq_hash_table *ht, struct entry *e) in h_next() argument
615 return to_entry(ht->es, e->hash_next); in h_next()
618 static void __h_insert(struct smq_hash_table *ht, unsigned int bucket, struct entry *e) in __h_insert() argument
620 e->hash_next = ht->buckets[bucket]; in __h_insert()
621 ht->buckets[bucket] = to_index(ht->es, e); in __h_insert()
624 static void h_insert(struct smq_hash_table *ht, struct entry *e) in h_insert() argument
626 unsigned int h = hash_64(from_oblock(e->oblock), ht->hash_bits); in h_insert()
628 __h_insert(ht, h, e); in h_insert()
631 static struct entry *__h_lookup(struct smq_hash_table *ht, unsigned int h, dm_oblock_t oblock, in __h_lookup() argument
637 for (e = h_head(ht, h); e; e = h_next(ht, e)) { in __h_lookup()
647 static void __h_unlink(struct smq_hash_table *ht, unsigned int h, in __h_unlink() argument
653 ht->buckets[h] = e->hash_next; in __h_unlink()
659 static struct entry *h_lookup(struct smq_hash_table *ht, dm_oblock_t oblock) in h_lookup() argument
662 unsigned int h = hash_64(from_oblock(oblock), ht->hash_bits); in h_lookup()
664 e = __h_lookup(ht, h, oblock, &prev); in h_lookup()
670 __h_unlink(ht, h, e, prev); in h_lookup()
671 __h_insert(ht, h, e); in h_lookup()
677 static void h_remove(struct smq_hash_table *ht, struct entry *e) in h_remove() argument
679 unsigned int h = hash_64(from_oblock(e->oblock), ht->hash_bits); in h_remove()
686 e = __h_lookup(ht, h, e->oblock, &prev); in h_remove()
688 __h_unlink(ht, h, e, prev); in h_remove()