1

bcachefs: Add some cond_rescheds() in shutdown path

Particularly on emergency shutdown we can end up having to clean up a
lot of dirty cached btree keys here.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2020-12-13 16:12:04 -05:00 committed by Kent Overstreet
parent 537c49d6af
commit 1d8305c11a

View File

@ -581,6 +581,8 @@ void bch2_fs_btree_key_cache_exit(struct btree_key_cache *bc)
list_splice(&bc->dirty, &bc->clean);
list_for_each_entry_safe(ck, n, &bc->clean, list) {
cond_resched();
bch2_journal_pin_drop(&c->journal, &ck->journal);
bch2_journal_preres_put(&c->journal, &ck->res);
@ -594,6 +596,8 @@ void bch2_fs_btree_key_cache_exit(struct btree_key_cache *bc)
BUG_ON(bc->nr_keys);
list_for_each_entry_safe(ck, n, &bc->freed, list) {
cond_resched();
list_del(&ck->list);
kmem_cache_free(bch2_key_cache, ck);
}