diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-11-29 17:09:13 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2020-12-16 15:29:08 -0500 |
commit | eb0d0c344c074acaee05b69550c1904f3cf179b8 (patch) | |
tree | 30ed12adc463d23f1e5987c8d2b4fcfce765da09 | |
parent | 4d3c24f50915212aa69df0942586809a96fe5f4a (diff) |
bcachefs: Fix journal reclaim spinning in recovery
We can't run journal reclaim until we've finished replaying updates to
interior btree nodes - the check for this was in the wrong place though,
leading to journal reclaim spinning before it was allowed to proceed.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/journal_reclaim.c | 5 | ||||
-rw-r--r-- | fs/bcachefs/recovery.c | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 2fa87c7dab7a..66f5dcce8889 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -609,6 +609,10 @@ static int bch2_journal_reclaim_thread(void *arg) struct journal *j = arg; unsigned long next; + set_freezable(); + + kthread_wait_freezable(test_bit(JOURNAL_RECLAIM_STARTED, &j->flags)); + while (!kthread_should_stop()) { j->reclaim_kicked = false; @@ -627,6 +631,7 @@ static int bch2_journal_reclaim_thread(void *arg) if (time_after_eq(jiffies, next)) break; schedule_timeout(next - jiffies); + try_to_freeze(); } __set_current_state(TASK_RUNNING); diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 6750063663b5..0b3521c9cc19 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -616,6 +616,7 @@ static int bch2_journal_replay(struct bch_fs *c, */ set_bit(BCH_FS_BTREE_INTERIOR_REPLAY_DONE, &c->flags); set_bit(JOURNAL_RECLAIM_STARTED, &j->flags); + journal_reclaim_kick(j); j->replay_journal_seq = seq; |