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_need_snapshot_cleanup)) {
- set_bit(BCH_FS_HAVE_DELETED_SNAPSHOTS, &c->flags);
- c->curr_recovery_pass = BCH_RECOVERY_PASS_delete_dead_snapshots;
- goto again;
- }
-
return ret;
}
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;