summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2023-08-30 06:45:59 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-09-09 21:19:29 -0400
commit594c33d7704f0d80acc7cc6d04693ecdea885a59 (patch)
treefb8acfbc4e27aef783fc1dcab564fc1378f82457
parentdf0bfb05a6b3817b1fb5ea4d80514681e86fe702 (diff)
bcachefs: restart journal reclaim thread on ro->rw transitions
Commit c2d5ff36065a4 ("bcachefs: Start journal reclaim thread earlier") tweaked reclaim thread management to start a bit earlier in the mount sequence by moving the start call from __bch2_fs_read_write() to bch2_fs_journal_start(). This has the side effect of never starting the reclaim thread on a ro->rw transition, which can be observed by monitoring reclaim behavior via the journal_reclaim tracepoints. I.e. once an fs has remounted ro->rw, we only ever rely on direct reclaim from that point forward. Since bch2_journal_reclaim_start() properly handles the case where the reclaim thread has already been created, restore the start call in the read-write helper. This allows the reclaim thread to start early when appropriate and also exit/restart on remounts or freeze cycles. In the latter case it may be possible to simply allow the task to freeze rather than destroy it, but for now just fix the immediate bug. Signed-off-by: Brian Foster <bfoster@redhat.com>
-rw-r--r--fs/bcachefs/super.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 60424865980d..29cd71445a94 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -421,6 +421,10 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
return ret;
}
+ ret = bch2_journal_reclaim_start(&c->journal);
+ if (ret)
+ goto err;
+
if (!early) {
ret = bch2_fs_read_write_late(c);
if (ret)