summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_key_cache.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-12-13 22:12:04 +0100
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:08:50 +0200
commit1d8305c11a289a13591d4c51726803cd37d8f646 (patch)
tree03bb60fa9997a360cbba0d3bfb1ede2b6e62cd41 /fs/bcachefs/btree_key_cache.c
parentbcachefs: Fix btree node merge -> split operations (diff)
downloadlinux-1d8305c11a289a13591d4c51726803cd37d8f646.tar.xz
linux-1d8305c11a289a13591d4c51726803cd37d8f646.zip
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>
Diffstat (limited to 'fs/bcachefs/btree_key_cache.c')
-rw-r--r--fs/bcachefs/btree_key_cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c
index 7416e7a49893..e6808d7139c6 100644
--- a/fs/bcachefs/btree_key_cache.c
+++ b/fs/bcachefs/btree_key_cache.c
@@ -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);
}