static struct entry *pop_old(struct smq_policy *mq, struct queue *q, unsigned max_level) { struct entry *e = q_pop_old(q, max_level); if (e) h_remove(&mq->table, e); return e; }
static void memqueue_free_consumer(consumer_t *consumer) { h_remove(consumer->memqueue->consumers, consumer->consumer_id); free(consumer->consumer_id); free(consumer); }
static struct entry *update_hotspot_queue(struct smq_policy *mq, dm_oblock_t b, struct bio *bio) { unsigned hi; dm_oblock_t hb = to_hblock(mq, b); struct entry *e = h_lookup(&mq->hotspot_table, hb); if (e) { stats_level_accessed(&mq->hotspot_stats, e->level); hi = get_index(&mq->hotspot_alloc, e); q_requeue(&mq->hotspot, e, test_and_set_bit(hi, mq->hotspot_hit_bits) ? 0u : mq->hotspot_level_jump); } else { stats_miss(&mq->hotspot_stats); e = alloc_entry(&mq->hotspot_alloc); if (!e) { e = q_pop(&mq->hotspot); if (e) { h_remove(&mq->hotspot_table, e); hi = get_index(&mq->hotspot_alloc, e); clear_bit(hi, mq->hotspot_hit_bits); } } if (e) { e->oblock = hb; q_push(&mq->hotspot, e); h_insert(&mq->hotspot_table, e); } } return e; }
/* * Removes an entry from cache. Removes from the hash table. */ static void __del(struct smq_policy *mq, struct queue *q, struct entry *e) { q_del(q, e); h_remove(&mq->table, e); }