diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h index 019d534b7325..3b39597a677a 100644 --- a/fs/bcachefs/bcachefs.h +++ b/fs/bcachefs/bcachefs.h @@ -995,6 +995,7 @@ struct bch_fs { enum bch_recovery_pass curr_recovery_pass; /* bitmap of explicitly enabled recovery passes: */ u64 recovery_passes_explicit; + u64 recovery_passes_complete; /* DEBUG JUNK */ struct dentry *fs_debug_dir; diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index 43e6222f124d..3f5b4d8ee4a5 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -43,7 +43,7 @@ static bool should_restart_for_topology_repair(struct bch_fs *c) { return c->opts.fix_errors != FSCK_FIX_no && - !(c->recovery_passes_explicit & BIT_ULL(BCH_RECOVERY_PASS_check_topology)); + !(c->recovery_passes_complete & BIT_ULL(BCH_RECOVERY_PASS_check_topology)); } static inline void __gc_pos_set(struct bch_fs *c, struct gc_pos new_pos) diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 3fd7f966acd7..edc9830d8163 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -1266,6 +1266,8 @@ static int bch2_run_recovery_pass(struct bch_fs *c, enum bch_recovery_pass pass) return ret; if (!(p->when & PASS_SILENT)) printk(KERN_CONT " done\n"); + + c->recovery_passes_complete |= BIT_ULL(pass); } return 0; diff --git a/fs/bcachefs/recovery.h b/fs/bcachefs/recovery.h index 26cd6a230ac0..0cd6b8a13c8c 100644 --- a/fs/bcachefs/recovery.h +++ b/fs/bcachefs/recovery.h @@ -68,6 +68,7 @@ static inline int bch2_run_explicit_recovery_pass(struct bch_fs *c, if (c->curr_recovery_pass >= pass) { c->curr_recovery_pass = pass; + c->recovery_passes_complete &= (1ULL << pass) >> 1; return -BCH_ERR_restart_recovery; } else { return 0;