bcachefs: Don't spin in journal reclaim
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 26 Feb 2022 03:45:58 +0000 (22:45 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:25 +0000 (17:09 -0400)
If we're not able to flush anything, we shouldn't keep looping.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/journal_reclaim.c

index 3cc980b0728551ef68d2e77639ee31776bf2836e..449f4fbfa326d8f45cf555da2e51621190ba04b7 100644 (file)
@@ -661,7 +661,7 @@ static int __bch2_journal_reclaim(struct journal *j, bool direct)
 
                if (nr_flushed)
                        wake_up(&j->reclaim_wait);
-       } while ((min_nr || min_key_cache) && !direct);
+       } while ((min_nr || min_key_cache) && nr_flushed && !direct);
 
        memalloc_noreclaim_restore(flags);