Loading fs/bcachefs/bcachefs_format.h +14 −0 Original line number Diff line number Diff line Loading @@ -1535,6 +1535,20 @@ enum btree_id { BTREE_ID_NR }; static inline bool btree_id_is_alloc(enum btree_id id) { switch (id) { case BTREE_ID_alloc: case BTREE_ID_backpointers: case BTREE_ID_need_discard: case BTREE_ID_freespace: case BTREE_ID_bucket_gens: return true; default: return false; } } #define BTREE_MAX_DEPTH 4U /* Btree nodes */ Loading fs/bcachefs/btree_gc.c +8 −3 Original line number Diff line number Diff line Loading @@ -368,11 +368,16 @@ static int bch2_btree_repair_topology_recurse(struct btree_trans *trans, struct buf.buf)) { bch2_btree_node_evict(trans, cur_k.k); cur = NULL; ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_scan_for_btree_nodes) ?: bch2_journal_key_delete(c, b->c.btree_id, ret = bch2_journal_key_delete(c, b->c.btree_id, b->c.level, cur_k.k->k.p); if (ret) break; if (!btree_id_is_alloc(b->c.btree_id)) { ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_scan_for_btree_nodes); if (ret) break; } continue; } Loading fs/bcachefs/btree_node_scan.c +7 −1 Original line number Diff line number Diff line Loading @@ -133,6 +133,9 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca, if (le64_to_cpu(bn->magic) != bset_magic(c)) return; if (btree_id_is_alloc(BTREE_NODE_ID(bn))) return; rcu_read_lock(); struct found_btree_node n = { .btree_id = BTREE_NODE_ID(bn), Loading Loading @@ -290,7 +293,7 @@ static int handle_overwrites(struct bch_fs *c, found_btree_node_to_text(&buf, c, n); bch_err(c, "%s", buf.buf); printbuf_exit(&buf); return -1; return -BCH_ERR_fsck_repair_unimplemented; } } Loading Loading @@ -436,6 +439,9 @@ bool bch2_btree_has_scanned_nodes(struct bch_fs *c, enum btree_id btree) int bch2_get_scanned_nodes(struct bch_fs *c, enum btree_id btree, unsigned level, struct bpos node_min, struct bpos node_max) { if (btree_id_is_alloc(btree)) return 0; struct find_btree_nodes *f = &c->found_btree_nodes; int ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_scan_for_btree_nodes); Loading fs/bcachefs/recovery.c +0 −14 Original line number Diff line number Diff line Loading @@ -47,20 +47,6 @@ void bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree) } } static bool btree_id_is_alloc(enum btree_id id) { switch (id) { case BTREE_ID_alloc: case BTREE_ID_backpointers: case BTREE_ID_need_discard: case BTREE_ID_freespace: case BTREE_ID_bucket_gens: return true; default: return false; } } /* for -o reconstruct_alloc: */ static void bch2_reconstruct_alloc(struct bch_fs *c) { Loading Loading
fs/bcachefs/bcachefs_format.h +14 −0 Original line number Diff line number Diff line Loading @@ -1535,6 +1535,20 @@ enum btree_id { BTREE_ID_NR }; static inline bool btree_id_is_alloc(enum btree_id id) { switch (id) { case BTREE_ID_alloc: case BTREE_ID_backpointers: case BTREE_ID_need_discard: case BTREE_ID_freespace: case BTREE_ID_bucket_gens: return true; default: return false; } } #define BTREE_MAX_DEPTH 4U /* Btree nodes */ Loading
fs/bcachefs/btree_gc.c +8 −3 Original line number Diff line number Diff line Loading @@ -368,11 +368,16 @@ static int bch2_btree_repair_topology_recurse(struct btree_trans *trans, struct buf.buf)) { bch2_btree_node_evict(trans, cur_k.k); cur = NULL; ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_scan_for_btree_nodes) ?: bch2_journal_key_delete(c, b->c.btree_id, ret = bch2_journal_key_delete(c, b->c.btree_id, b->c.level, cur_k.k->k.p); if (ret) break; if (!btree_id_is_alloc(b->c.btree_id)) { ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_scan_for_btree_nodes); if (ret) break; } continue; } Loading
fs/bcachefs/btree_node_scan.c +7 −1 Original line number Diff line number Diff line Loading @@ -133,6 +133,9 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca, if (le64_to_cpu(bn->magic) != bset_magic(c)) return; if (btree_id_is_alloc(BTREE_NODE_ID(bn))) return; rcu_read_lock(); struct found_btree_node n = { .btree_id = BTREE_NODE_ID(bn), Loading Loading @@ -290,7 +293,7 @@ static int handle_overwrites(struct bch_fs *c, found_btree_node_to_text(&buf, c, n); bch_err(c, "%s", buf.buf); printbuf_exit(&buf); return -1; return -BCH_ERR_fsck_repair_unimplemented; } } Loading Loading @@ -436,6 +439,9 @@ bool bch2_btree_has_scanned_nodes(struct bch_fs *c, enum btree_id btree) int bch2_get_scanned_nodes(struct bch_fs *c, enum btree_id btree, unsigned level, struct bpos node_min, struct bpos node_max) { if (btree_id_is_alloc(btree)) return 0; struct find_btree_nodes *f = &c->found_btree_nodes; int ret = bch2_run_explicit_recovery_pass(c, BCH_RECOVERY_PASS_scan_for_btree_nodes); Loading
fs/bcachefs/recovery.c +0 −14 Original line number Diff line number Diff line Loading @@ -47,20 +47,6 @@ void bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree) } } static bool btree_id_is_alloc(enum btree_id id) { switch (id) { case BTREE_ID_alloc: case BTREE_ID_backpointers: case BTREE_ID_need_discard: case BTREE_ID_freespace: case BTREE_ID_bucket_gens: return true; default: return false; } } /* for -o reconstruct_alloc: */ static void bch2_reconstruct_alloc(struct bch_fs *c) { Loading