Loading fs/bcachefs/recovery_passes.c +30 −33 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ #include "journal.h" #include "lru.h" #include "logged_ops.h" #include "movinggc.h" #include "rebalance.h" #include "recovery.h" #include "recovery_passes.h" Loading Loading @@ -262,33 +263,26 @@ int bch2_run_recovery_passes(struct bch_fs *c) */ c->opts.recovery_passes_exclude &= ~BCH_RECOVERY_PASS_set_may_go_rw; while (c->curr_recovery_pass < ARRAY_SIZE(recovery_pass_fns) && !ret) { c->next_recovery_pass = c->curr_recovery_pass + 1; spin_lock_irq(&c->recovery_pass_lock); while (c->curr_recovery_pass < ARRAY_SIZE(recovery_pass_fns) && !ret) { unsigned pass = c->curr_recovery_pass; c->next_recovery_pass = pass + 1; if (c->opts.recovery_pass_last && c->curr_recovery_pass > c->opts.recovery_pass_last) { spin_unlock_irq(&c->recovery_pass_lock); c->curr_recovery_pass > c->opts.recovery_pass_last) break; } if (!should_run_recovery_pass(c, pass)) { c->curr_recovery_pass++; c->recovery_pass_done = max(c->recovery_pass_done, pass); if (should_run_recovery_pass(c, pass)) { spin_unlock_irq(&c->recovery_pass_lock); continue; } spin_unlock_irq(&c->recovery_pass_lock); ret = bch2_run_recovery_pass(c, pass) ?: bch2_journal_flush(&c->journal); if (!ret && !test_bit(BCH_FS_error, &c->flags)) bch2_clear_recovery_pass_required(c, pass); spin_lock_irq(&c->recovery_pass_lock); if (c->next_recovery_pass < c->curr_recovery_pass) { /* * bch2_run_explicit_recovery_pass() was called: we Loading @@ -302,9 +296,12 @@ int bch2_run_recovery_passes(struct bch_fs *c) c->recovery_passes_complete |= BIT_ULL(pass); c->recovery_pass_done = max(c->recovery_pass_done, pass); } } c->curr_recovery_pass = c->next_recovery_pass; spin_unlock_irq(&c->recovery_pass_lock); } spin_unlock_irq(&c->recovery_pass_lock); return ret; } Loading
fs/bcachefs/recovery_passes.c +30 −33 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ #include "journal.h" #include "lru.h" #include "logged_ops.h" #include "movinggc.h" #include "rebalance.h" #include "recovery.h" #include "recovery_passes.h" Loading Loading @@ -262,33 +263,26 @@ int bch2_run_recovery_passes(struct bch_fs *c) */ c->opts.recovery_passes_exclude &= ~BCH_RECOVERY_PASS_set_may_go_rw; while (c->curr_recovery_pass < ARRAY_SIZE(recovery_pass_fns) && !ret) { c->next_recovery_pass = c->curr_recovery_pass + 1; spin_lock_irq(&c->recovery_pass_lock); while (c->curr_recovery_pass < ARRAY_SIZE(recovery_pass_fns) && !ret) { unsigned pass = c->curr_recovery_pass; c->next_recovery_pass = pass + 1; if (c->opts.recovery_pass_last && c->curr_recovery_pass > c->opts.recovery_pass_last) { spin_unlock_irq(&c->recovery_pass_lock); c->curr_recovery_pass > c->opts.recovery_pass_last) break; } if (!should_run_recovery_pass(c, pass)) { c->curr_recovery_pass++; c->recovery_pass_done = max(c->recovery_pass_done, pass); if (should_run_recovery_pass(c, pass)) { spin_unlock_irq(&c->recovery_pass_lock); continue; } spin_unlock_irq(&c->recovery_pass_lock); ret = bch2_run_recovery_pass(c, pass) ?: bch2_journal_flush(&c->journal); if (!ret && !test_bit(BCH_FS_error, &c->flags)) bch2_clear_recovery_pass_required(c, pass); spin_lock_irq(&c->recovery_pass_lock); if (c->next_recovery_pass < c->curr_recovery_pass) { /* * bch2_run_explicit_recovery_pass() was called: we Loading @@ -302,9 +296,12 @@ int bch2_run_recovery_passes(struct bch_fs *c) c->recovery_passes_complete |= BIT_ULL(pass); c->recovery_pass_done = max(c->recovery_pass_done, pass); } } c->curr_recovery_pass = c->next_recovery_pass; spin_unlock_irq(&c->recovery_pass_lock); } spin_unlock_irq(&c->recovery_pass_lock); return ret; }