bcachefs: Topology repair now uses nodes found by scanning to fill holes
authorKent Overstreet <kent.overstreet@linux.dev>
Sun, 17 Mar 2024 02:45:30 +0000 (22:45 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 3 Apr 2024 18:45:30 +0000 (14:45 -0400)
commit43f5ea4646b2271a9a5af3729dfdf644d69b3282
treee1bdfa2f6a07de2514345fa52f2b0c03302fe0c3
parent4409b8081d1624af814a9cda781ad9cdda3973cb
bcachefs: Topology repair now uses nodes found by scanning to fill holes

With the new btree node scan code, we can now recover from corrupt btree
roots - simply create a new fake root at depth 1, and then insert all
the leaves we found.

If the root wasn't corrupt but there's corruption elsewhere in the
btree, we can fill in holes as needed with the newest version of a given
node(s) from the scan; we also check if a given btree node is older than
what we found from the scan.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_gc.c
fs/bcachefs/sb-errors_types.h