summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-08-04 03:57:06 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:10:09 +0300
commit0ed4ca146efda60057782ccda6dc056bf538cc75 (patch)
treebfef9b68303b7cc6a959bb4cb2b9b91f4837cd7a
parentad52bac251589cdcd206bfec46d670ba00e6edab (diff)
downloadlinux-0ed4ca146efda60057782ccda6dc056bf538cc75.tar.xz
bcachefs: Ensure topology repair runs
This fixes should_restart_for_topology_repair() - previously it was returning false if the btree io path had already seleceted topology repair to run, even if it hadn't run yet. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/bcachefs.h1
-rw-r--r--fs/bcachefs/btree_gc.c2
-rw-r--r--fs/bcachefs/recovery.c2
-rw-r--r--fs/bcachefs/recovery.h1
4 files changed, 5 insertions, 1 deletions
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;