diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-17 04:51:58 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2022-10-17 07:04:50 -0400 |
commit | b34d7c85876c913e77ea1d9e7f676d19029df31b (patch) | |
tree | c428bd0e33f47bc40b21321f934f596d2b5f30fe | |
parent | 82ab98cf587aafcb4482223ddb8987a903234855 (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>
-rw-r--r-- | fs/bcachefs/super.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 3f674bf061ff..c7fd54ebc7b4 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -327,26 +327,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; } @@ -385,6 +371,20 @@ 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; + } + + schedule_work(&c->ec_stripe_delete_work); + bch2_do_discards(c); bch2_do_invalidates(c); |