summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-04-24 09:09:56 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-04-28 22:42:22 -0400
commit712ef7cd339ccdbe2c7402899dc4d4c1b0fdea9f (patch)
treef8c04e73d935a8d4e3283e64c1e533fbb510a5f9
parentd355ba9417ba4b4a7cbb884e6e3ab4d3a313bf1d (diff)
bcachefs: bch2_btree_lost_data() now handles snapshots tree
We have a consolidated places for "this btree lost data, run this repair", so use it. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/recovery.c4
-rw-r--r--fs/bcachefs/snapshot.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 359639175eaa..294b8091e52d 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -95,6 +95,10 @@ int bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree)
case BTREE_ID_accounting:
ret = bch2_run_explicit_recovery_pass_persistent_locked(c, BCH_RECOVERY_PASS_check_allocations) ?: ret;
goto out;
+ case BTREE_ID_snapshots:
+ ret = bch2_run_explicit_recovery_pass_persistent_locked(c, BCH_RECOVERY_PASS_reconstruct_snapshots) ?: ret;
+ ret = bch2_run_explicit_recovery_pass_persistent_locked(c, BCH_RECOVERY_PASS_scan_for_btree_nodes) ?: ret;
+ goto out;
default:
ret = bch2_run_explicit_recovery_pass_persistent_locked(c, BCH_RECOVERY_PASS_scan_for_btree_nodes) ?: ret;
goto out;
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 14ea09ccee37..94cf60f76b64 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1743,10 +1743,6 @@ int bch2_snapshots_read(struct bch_fs *c)
BUG_ON(!test_bit(BCH_FS_new_fs, &c->flags) &&
test_bit(BCH_FS_may_go_rw, &c->flags));
- if (bch2_err_matches(ret, EIO) ||
- (c->sb.btrees_lost_data & BIT_ULL(BTREE_ID_snapshots)))
- ret = bch2_run_explicit_recovery_pass_persistent(c, BCH_RECOVERY_PASS_reconstruct_snapshots);
-
return ret;
}