Skip to content

Commit 4409b80

Browse files
author
Kent Overstreet
committed
bcachefs: Repair pass for scanning for btree nodes
If a btree root or interior btree node goes bad, we're going to lose a lot of data, unless we can recover the nodes that it pointed to by scanning. Fortunately btree node headers are fully self describing, and additionally the magic number is xored with the filesytem UUID, so we can do so safely. This implements the scanning - next patch will rework topology repair to make use of the found nodes. Signed-off-by: Kent Overstreet <[email protected]>
1 parent b268aa4 commit 4409b80

File tree

12 files changed

+605
-51
lines changed

12 files changed

+605
-51
lines changed

fs/bcachefs/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ bcachefs-y := \
1717
btree_journal_iter.o \
1818
btree_key_cache.o \
1919
btree_locking.o \
20+
btree_node_scan.o \
2021
btree_trans_commit.o \
2122
btree_update.o \
2223
btree_update_interior.o \

fs/bcachefs/bcachefs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ enum bch_time_stats {
456456

457457
#include "alloc_types.h"
458458
#include "btree_types.h"
459+
#include "btree_node_scan_types.h"
459460
#include "btree_write_buffer_types.h"
460461
#include "buckets_types.h"
461462
#include "buckets_waiting_for_journal_types.h"
@@ -1103,6 +1104,8 @@ struct bch_fs {
11031104
struct journal_keys journal_keys;
11041105
struct list_head journal_iters;
11051106

1107+
struct find_btree_nodes found_btree_nodes;
1108+
11061109
u64 last_bucket_seq_cleanup;
11071110

11081111
u64 counters_on_mount[BCH_COUNTER_NR];

0 commit comments

Comments
 (0)