Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
bcachefs: Repair pass for scanning for btree nodes
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Kent Overstreet committed Apr 3, 2024
1 parent b268aa4 commit 4409b80
Show file tree
Hide file tree
Showing 12 changed files with 605 additions and 51 deletions.
1 change: 1 addition & 0 deletions fs/bcachefs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ bcachefs-y := \
btree_journal_iter.o \
btree_key_cache.o \
btree_locking.o \
btree_node_scan.o \
btree_trans_commit.o \
btree_update.o \
btree_update_interior.o \
Expand Down
3 changes: 3 additions & 0 deletions fs/bcachefs/bcachefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ enum bch_time_stats {

#include "alloc_types.h"
#include "btree_types.h"
#include "btree_node_scan_types.h"
#include "btree_write_buffer_types.h"
#include "buckets_types.h"
#include "buckets_waiting_for_journal_types.h"
Expand Down Expand Up @@ -1103,6 +1104,8 @@ struct bch_fs {
struct journal_keys journal_keys;
struct list_head journal_iters;

struct find_btree_nodes found_btree_nodes;

u64 last_bucket_seq_cleanup;

u64 counters_on_mount[BCH_COUNTER_NR];
Expand Down
Loading

0 comments on commit 4409b80

Please sign in to comment.