summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/recovery.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-07-17 05:19:49 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:10:08 +0200
commit922bc5a037ecf82d3cbad1c9976274f441328274 (patch)
treeda23feb08c6cba2ba20492f7afb98d4ee386468c /fs/bcachefs/recovery.c
parentbcachefs: bch2_run_explicit_recovery_pass() (diff)
downloadlinux-922bc5a037ecf82d3cbad1c9976274f441328274.tar.xz
linux-922bc5a037ecf82d3cbad1c9976274f441328274.zip
bcachefs: Make topology repair a normal recovery pass
This adds bch2_run_explicit_recovery_pass(), for rewinding recovery and explicitly running a specific recovery pass - this is a more general replacement for how we were running topology repair before. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/recovery.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 433e7745799b..dcd4f9f410ae 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -1262,17 +1262,16 @@ static int bch2_run_recovery_pass(struct bch_fs *c, enum bch_recovery_pass pass)
static int bch2_run_recovery_passes(struct bch_fs *c)
{
int ret = 0;
-again:
+
while (c->curr_recovery_pass < ARRAY_SIZE(recovery_passes)) {
ret = bch2_run_recovery_pass(c, c->curr_recovery_pass);
+ if (bch2_err_matches(ret, BCH_ERR_restart_recovery))
+ continue;
if (ret)
break;
c->curr_recovery_pass++;
}
- if (bch2_err_matches(ret, BCH_ERR_restart_recovery))
- goto again;
-
return ret;
}
@@ -1450,6 +1449,11 @@ use_clean:
if (ret)
goto err;
+ if (c->opts.fsck &&
+ (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) ||
+ BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb)))
+ c->recovery_passes_explicit |= BIT_ULL(BCH_RECOVERY_PASS_check_topology);
+
ret = bch2_run_recovery_passes(c);
if (ret)
goto err;