void mc_stats_reset(void) { #ifdef CONFIG_GSLOCK spin_lock(&stats_lock); stats.total_items = 0; stats.total_conns = 0; stats.rejected_conns = 0; stats.evictions = 0; stats.reclaimed = 0; stats.listen_disabled_num = 0; spin_unlock(&stats_lock); #else ATOMIC32_SET(stats.total_items, 0); ATOMIC32_SET(stats.total_conns, 0); ATOMIC64_SET(stats.rejected_conns, 0); ATOMIC64_SET(stats.evictions, 0); ATOMIC64_SET(stats.reclaimed, 0); ATOMIC64_SET(stats.listen_disabled_num, 0); #endif mutex_lock(&prefix_stats_lock); mc_stats_prefix_clear(); mutex_unlock(&prefix_stats_lock); mc_threadlocal_stats_reset(); mc_item_stats_reset(); }
int hash_init(int power) { size_t bytes; int ret = 0; if (power) hashpower = power; bytes = hashsize(hashpower) * sizeof(void *); ret = alloc_buffer(&primary_hts, bytes, __GFP_ZERO); if (ret) { PRINTK("alloc primary_hashtable error\n"); goto out; } else { BUFFER_PTR(&primary_hts, primary_hashtable); } ATOMIC32_SET(stats.hash_power_level, hashpower); ATOMIC64_SET(stats.hash_bytes, bytes); out: return ret; }