diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-07 02:42:28 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:06 -0400 |
commit | 067d228bb0c40542620398ef1d79f00f47c05cbb (patch) | |
tree | 41402dddcd6aa5921eec83a4917c584d3a920e19 /fs/bcachefs/btree_gc.c | |
parent | 78328fec704e316b36142a9a13af8665cd46da47 (diff) |
bcachefs: Enumerate recovery passes
Recovery and fsck have many different passes/jobs to do, which always
run in the same order - but not all of them run all the time. Some are
for fsck, some for unclean shutdown, some for version upgrades.
This adds some new structure: a defined list of recovery passes that we
can run in a loop, as well as consolidating the log messages.
The main benefit is consolidating the "should run this recovery pass"
logic, as well as cleaning up the "this recovery pass has finished"
state; instead of having a bunch of ad-hoc state bits in c->flags, we've
now got c->curr_recovery_pass.
By consolidating the "should run this recovery pass" logic, in the
future on disk format upgrades will be able to say "upgrading to this
version requires x passes to run", instead of forcing all of fsck to
run.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_gc.c')
-rw-r--r-- | fs/bcachefs/btree_gc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index ac6c748e0f7c..6000b09dec26 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -1807,7 +1807,7 @@ again: if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) || (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb) && - !test_bit(BCH_FS_INITIAL_GC_DONE, &c->flags) && + c->curr_recovery_pass <= BCH_RECOVERY_PASS_check_allocations && c->opts.fix_errors != FSCK_OPT_NO)) { bch_info(c, "Starting topology repair pass"); ret = bch2_repair_topology(c); @@ -1822,7 +1822,7 @@ again: if (ret == -BCH_ERR_need_topology_repair && !test_bit(BCH_FS_TOPOLOGY_REPAIR_DONE, &c->flags) && - !test_bit(BCH_FS_INITIAL_GC_DONE, &c->flags)) { + c->curr_recovery_pass <= BCH_RECOVERY_PASS_check_allocations) { set_bit(BCH_FS_NEED_ANOTHER_GC, &c->flags); SET_BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb, true); ret = 0; |