bcachefs: Add a cond_resched() call to journal_keys_sort()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 4 Apr 2023 17:25:06 +0000 (13:25 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:59 +0000 (17:09 -0400)
We're just doing cpu work here and it could take awhile, a
cond_resched() is definitely needed.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/recovery.c

index 8cc8af6d29ef0ad6106a8b151627be14edc67a73..91a66b5916eb7ed0d2629c0ee64424678ae7ec3b 100644 (file)
@@ -543,6 +543,8 @@ static int journal_keys_sort(struct bch_fs *c)
                if (!i || i->ignore)
                        continue;
 
+               cond_resched();
+
                for_each_jset_key(k, entry, &i->j) {
                        if (keys->nr == keys->size) {
                                __journal_keys_sort(keys);