summaryrefslogtreecommitdiff
path: root/fs/bcachefs/super.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-07-10 17:23:59 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-06 13:50:36 -0400
commit7b69ed288d1332b48cb574a2ea3e98e36eb6f2e7 (patch)
treefecee2492e6c9ea2653110dda63da9d09ea4c9d1 /fs/bcachefs/super.c
parentfbb93b5d35e27306b9a31701d3b81800cdb3e611 (diff)
bcachefs: Don't start copygc until recovery is finished
With "bcachefs: Snapshot depth, skiplist fields", we now can't run data move operations until after bch2_check_snapshots() is complete. Ideally we'd have the copygc (and rebalance) threads wait until c->curr_recovery_pass has advanced, but the waitlist handling is tricky - so for now, move starting copygc back to read_write_late(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super.c')
-rw-r--r--fs/bcachefs/super.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 6ab98c2299dd..63e9dafa8395 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -344,6 +344,19 @@ static int bch2_fs_read_write_late(struct bch_fs *c)
{
int ret;
+ /*
+ * Data move operations can't run until after check_snapshots has
+ * completed, and bch2_snapshot_is_ancestor() is available.
+ *
+ * Ideally we'd start copygc/rebalance earlier instead of waiting for
+ * all of recovery/fsck to complete:
+ */
+ 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");
@@ -403,12 +416,6 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
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)