summaryrefslogtreecommitdiff
path: root/libbcachefs/recovery_passes.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbcachefs/recovery_passes.c')
-rw-r--r--libbcachefs/recovery_passes.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/libbcachefs/recovery_passes.c b/libbcachefs/recovery_passes.c
index 87150dd3..e14aca00 100644
--- a/libbcachefs/recovery_passes.c
+++ b/libbcachefs/recovery_passes.c
@@ -141,13 +141,13 @@ static int __bch2_run_explicit_recovery_pass(struct printbuf *out,
if (pass < BCH_RECOVERY_PASS_set_may_go_rw &&
c->curr_recovery_pass >= BCH_RECOVERY_PASS_set_may_go_rw) {
if (print)
- prt_printf(out, "need recovery pass %s (%u), but already rw",
+ prt_printf(out, "need recovery pass %s (%u), but already rw\n",
bch2_recovery_passes[pass], pass);
return -BCH_ERR_cannot_rewind_recovery;
}
if (print)
- prt_printf(out, "running explicit recovery pass %s (%u), currently at %s (%u)",
+ prt_printf(out, "running explicit recovery pass %s (%u), currently at %s (%u)\n",
bch2_recovery_passes[pass], pass,
bch2_recovery_passes[c->curr_recovery_pass], c->curr_recovery_pass);
@@ -162,7 +162,7 @@ static int __bch2_run_explicit_recovery_pass(struct printbuf *out,
}
}
-int bch2_run_explicit_recovery_pass_printbuf(struct bch_fs *c,
+static int bch2_run_explicit_recovery_pass_printbuf(struct bch_fs *c,
struct printbuf *out,
enum bch_recovery_pass pass)
{
@@ -193,32 +193,30 @@ int bch2_run_explicit_recovery_pass(struct bch_fs *c,
return ret;
}
-int bch2_run_explicit_recovery_pass_persistent_locked(struct bch_fs *c,
- enum bch_recovery_pass pass)
+int __bch2_run_explicit_recovery_pass_persistent(struct bch_fs *c,
+ struct printbuf *out,
+ enum bch_recovery_pass pass)
{
lockdep_assert_held(&c->sb_lock);
struct bch_sb_field_ext *ext = bch2_sb_field_get(c->disk_sb.sb, ext);
__set_bit_le64(bch2_recovery_pass_to_stable(pass), ext->recovery_passes_required);
- return bch2_run_explicit_recovery_pass(c, pass);
+ return bch2_run_explicit_recovery_pass_printbuf(c, out, pass);
}
int bch2_run_explicit_recovery_pass_persistent(struct bch_fs *c,
+ struct printbuf *out,
enum bch_recovery_pass pass)
{
- enum bch_recovery_pass_stable s = bch2_recovery_pass_to_stable(pass);
+ if (c->sb.recovery_passes_required & BIT_ULL(pass))
+ return 0;
mutex_lock(&c->sb_lock);
- struct bch_sb_field_ext *ext = bch2_sb_field_get(c->disk_sb.sb, ext);
-
- if (!test_bit_le64(s, ext->recovery_passes_required)) {
- __set_bit_le64(s, ext->recovery_passes_required);
- bch2_write_super(c);
- }
+ int ret = __bch2_run_explicit_recovery_pass_persistent(c, out, pass);
mutex_unlock(&c->sb_lock);
- return bch2_run_explicit_recovery_pass(c, pass);
+ return ret;
}
static void bch2_clear_recovery_pass_required(struct bch_fs *c,