bcachefs: New and improved topology repair code
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 24 Apr 2021 20:32:35 +0000 (16:32 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:02 +0000 (17:09 -0400)
commitaae15aafcd43ec5346ac6c3f61c09798d26593ee
tree49df821335528b7d153ea17f6cfaf99c72321f3b
parent4932e07ea04bcc7f1649052183d1ebbab30c711c
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>
fs/bcachefs/bcachefs.h
fs/bcachefs/bcachefs_format.h
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_io.c
fs/bcachefs/btree_io.h
fs/bcachefs/btree_update_interior.c
fs/bcachefs/error.c
fs/bcachefs/error.h
fs/bcachefs/recovery.c
fs/bcachefs/super-io.c
fs/bcachefs/super.c