diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-17 04:51:58 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:50 -0400 |
commit | 5f5c74661713327309f124e247de61db6729bc3d (patch) | |
tree | d610d3875696b9303795a9a6e76abf7c84135599 /fs/bcachefs/super.c | |
parent | 30ca6ece88f2d11647c3854faf0dce528c32d5cf (diff) |
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.c | 26 |
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) |