]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bcachefs: Add a cond_resched() to __journal_keys_sort()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 5 Sep 2024 19:43:03 +0000 (15:43 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 9 Sep 2024 13:41:46 +0000 (09:41 -0400)
Without this, we'd potentially sort multiple times without a
cond_resched(), leading to hung task warnings on larger systems.

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

index 74933490aaba9dfbaed84a957a8223cf2b5a9c5c..c1657182c2758253710e78ed138b974428f31a6e 100644 (file)
@@ -530,6 +530,8 @@ static void __journal_keys_sort(struct journal_keys *keys)
 {
        sort(keys->data, keys->nr, sizeof(keys->data[0]), journal_sort_key_cmp, NULL);
 
+       cond_resched();
+
        struct journal_key *dst = keys->data;
 
        darray_for_each(*keys, src) {