aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/super-io.c
diff options
context:
space:
mode:
authorGravatar Kent Overstreet <kent.overstreet@gmail.com> 2021-04-24 16:32:35 -0400
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-10-22 17:09:02 -0400
commitaae15aafcd43ec5346ac6c3f61c09798d26593ee (patch)
tree49df821335528b7d153ea17f6cfaf99c72321f3b /fs/bcachefs/super-io.c
parentbcachefs: Fix key cache assertion (diff)
downloadlinux-aae15aafcd43ec5346ac6c3f61c09798d26593ee.tar.gz
linux-aae15aafcd43ec5346ac6c3f61c09798d26593ee.tar.bz2
linux-aae15aafcd43ec5346ac6c3f61c09798d26593ee.zip
bcachefs: New and improved topology repair code
This splits out btree topology repair into a separate pass, and makes some improvements: - When we have to pick which of two overlapping nodes to drop keys from, we use the btree node header sequence number to preserve the newer node - the gc code has been changed so that it doesn't bail out if we're continuing/ignoring on fsck error - this way the dump tool can skip running the repair pass but still walk all reachable metadata - add a new superblock flag indicating when a filesystem is known to have btree topology issues, and the topology repair pass should be run - changing the start/end of a node might mean keys in that node have to be deleted: this patch handles that better by splitting it out into a separate function and running it explicitly in the topology repair code, previously those keys were only being dropped when the btree node was read in. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r--fs/bcachefs/super-io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index bf36a5743607..e0de6f0c0cb4 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -439,6 +439,11 @@ int bch2_sb_to_fs(struct bch_fs *c, struct bch_sb *src)
__copy_super(&c->disk_sb, src);
+ if (BCH_SB_HAS_ERRORS(c->disk_sb.sb))
+ set_bit(BCH_FS_ERROR, &c->flags);
+ if (BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb))
+ set_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags);
+
ret = bch2_sb_replicas_to_cpu_replicas(c);
if (ret)
return ret;
@@ -715,6 +720,8 @@ int bch2_write_super(struct bch_fs *c)
if (test_bit(BCH_FS_ERROR, &c->flags))
SET_BCH_SB_HAS_ERRORS(c->disk_sb.sb, 1);
+ if (test_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags))
+ SET_BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb, 1);
SET_BCH_SB_BIG_ENDIAN(c->disk_sb.sb, CPU_BIG_ENDIAN);