diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-03-21 19:02:48 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:18 -0400 |
commit | 05235e99281533a70abee7f86181d3963f317913 (patch) | |
tree | ea3786b4ce810acc9de41dccb14e87b3dddc1320 /fs | |
parent | 082f0801e0c96a4dbea67998b63c29c18da2419f (diff) | |
download | linux-05235e99281533a70abee7f86181d3963f317913.tar.gz linux-05235e99281533a70abee7f86181d3963f317913.tar.bz2 linux-05235e99281533a70abee7f86181d3963f317913.zip |
bcachefs: Run gc if failed to read alloc btree
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/recovery.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 9610b488fbdf..24101023a5b9 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -187,6 +187,8 @@ int bch2_fs_recovery(struct bch_fs *c) LIST_HEAD(journal); struct jset *j = NULL; unsigned i; + bool run_gc = c->opts.fsck || + !(c->sb.compat & (1ULL << BCH_COMPAT_FEAT_ALLOC_INFO)); int ret; mutex_lock(&c->sb_lock); @@ -282,6 +284,7 @@ int bch2_fs_recovery(struct bch_fs *c) goto err; mustfix_fsck_err(c, "error reading btree root"); + run_gc = true; } } @@ -302,8 +305,7 @@ int bch2_fs_recovery(struct bch_fs *c) set_bit(BCH_FS_ALLOC_READ_DONE, &c->flags); - if (!(c->sb.compat & (1ULL << BCH_COMPAT_FEAT_ALLOC_INFO)) || - c->opts.fsck) { + if (run_gc) { bch_verbose(c, "starting mark and sweep:"); err = "error in recovery"; ret = bch2_gc(c, &journal, true); |