summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-10-17 11:51:58 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:50 +0300
commit5f5c74661713327309f124e247de61db6729bc3d (patch)
treed610d3875696b9303795a9a6e76abf7c84135599 /fs/bcachefs/super.c
parent30ca6ece88f2d11647c3854faf0dce528c32d5cf (diff)
downloadlinux-5f5c74661713327309f124e247de61db6729bc3d.tar.xz
bcachefs: Start copygc when first going read-write
In the distant past, it wasn't possible to start copygc until after journal replay had finished. Now, the btree iterator code overlays keys from the journal, so there's no reason not to start it earlier - and it solves a rare deadlock. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 872b82a24505..e7e3dcbe2339 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -332,26 +332,12 @@ static int bch2_fs_read_write_late(struct bch_fs *c)
{
int ret;
- ret = bch2_gc_thread_start(c);
- if (ret) {
- bch_err(c, "error starting gc thread");
- return ret;
- }
-
- ret = bch2_copygc_start(c);
- if (ret) {
- bch_err(c, "error starting copygc thread");
- return ret;
- }
-
ret = bch2_rebalance_start(c);
if (ret) {
bch_err(c, "error starting rebalance thread");
return ret;
}
- schedule_work(&c->ec_stripe_delete_work);
-
return 0;
}
@@ -398,6 +384,18 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
bch2_dev_allocator_add(c, ca);
bch2_recalc_capacity(c);
+ ret = bch2_gc_thread_start(c);
+ if (ret) {
+ bch_err(c, "error starting gc thread");
+ return ret;
+ }
+
+ ret = bch2_copygc_start(c);
+ if (ret) {
+ bch_err(c, "error starting copygc thread");
+ return ret;
+ }
+
if (!early) {
ret = bch2_fs_read_write_late(c);
if (ret)