bcachefs: Add an assertion for removing btree nodes from cache
Chasing a bug that has something to do with the btree node cache. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
f21566f17a
commit
cab8e23373
@ -129,7 +129,8 @@ struct btree *__bch2_btree_node_mem_alloc(struct bch_fs *c)
|
||||
|
||||
void bch2_btree_node_hash_remove(struct btree_cache *bc, struct btree *b)
|
||||
{
|
||||
rhashtable_remove_fast(&bc->table, &b->hash, bch_btree_cache_params);
|
||||
int ret = rhashtable_remove_fast(&bc->table, &b->hash, bch_btree_cache_params);
|
||||
BUG_ON(ret);
|
||||
|
||||
/* Cause future lookups for this node to fail: */
|
||||
b->hash_val = 0;
|
||||
|
@ -153,8 +153,6 @@ static void __btree_node_free(struct bch_fs *c, struct btree *b)
|
||||
|
||||
clear_btree_node_noevict(b);
|
||||
|
||||
bch2_btree_node_hash_remove(&c->btree_cache, b);
|
||||
|
||||
mutex_lock(&c->btree_cache.lock);
|
||||
list_move(&b->list, &c->btree_cache.freeable);
|
||||
mutex_unlock(&c->btree_cache.lock);
|
||||
@ -170,7 +168,10 @@ static void bch2_btree_node_free_inmem(struct btree_trans *trans,
|
||||
BUG_ON(iter->l[b->c.level].b == b);
|
||||
|
||||
six_lock_write(&b->c.lock, NULL, NULL);
|
||||
|
||||
bch2_btree_node_hash_remove(&c->btree_cache, b);
|
||||
__btree_node_free(c, b);
|
||||
|
||||
six_unlock_write(&b->c.lock);
|
||||
six_unlock_intent(&b->c.lock);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user