summaryrefslogtreecommitdiff
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-02-06 11:56:51 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:15 -0400
commit1df42b571535ed3fd8d9d94f674c626746dc0275 (patch)
tree73dbfa3cd3d080f54934f6ce330d65cc2a265a42 /fs/bcachefs/recovery.c
parent3577df5f7f25f6669c4b53e76cf159d550a0fd83 (diff)
downloadlwn-1df42b571535ed3fd8d9d94f674c626746dc0275.tar.gz
lwn-1df42b571535ed3fd8d9d94f674c626746dc0275.zip
bcachefs: don't do initial gc if have alloc info feature
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/recovery.c')
-rw-r--r--fs/bcachefs/recovery.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 31d2bce7bb57..1c09ae4f5f2f 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -300,14 +300,18 @@ int bch2_fs_recovery(struct bch_fs *c)
set_bit(BCH_FS_ALLOC_READ_DONE, &c->flags);
- bch_verbose(c, "starting mark and sweep:");
- err = "error in recovery";
- ret = bch2_gc(c, &journal, true);
- if (ret)
- goto err;
- bch_verbose(c, "mark and sweep done");
+ if (!(c->sb.compat & (1ULL << BCH_COMPAT_FEAT_ALLOC_INFO)) ||
+ c->opts.fsck) {
+ bch_verbose(c, "starting mark and sweep:");
+ err = "error in recovery";
+ ret = bch2_gc(c, &journal, true);
+ if (ret)
+ goto err;
+ bch_verbose(c, "mark and sweep done");
+ }
clear_bit(BCH_FS_REBUILD_REPLICAS, &c->flags);
+ set_bit(BCH_FS_INITIAL_GC_DONE, &c->flags);
/*
* Skip past versions that might have possibly been used (as nonces),
@@ -411,6 +415,8 @@ int bch2_fs_initialize(struct bch_fs *c)
if (ret)
goto err;
+ set_bit(BCH_FS_INITIAL_GC_DONE, &c->flags);
+
err = "unable to allocate journal buckets";
for_each_online_member(ca, c, i)
if (bch2_dev_journal_alloc(ca)) {