mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
bcachefs: Only run 'increase_depth' for keys from btree node csan
bch2_btree_increase_depth() was originally for disaster recovery, to get some data back from the journal when a btree root was bad. We don't need it for that purpose anymore; on bad btree root we'll launch btree node scan and reconstruct all the interior nodes. If there's a key in the journal for a depth that doesn't exists, and it's not from check_topology/btree node scan, we should just ignore it. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
7b0e6b198e
commit
b47a82ff47
1 changed files with 12 additions and 1 deletions
|
@ -271,13 +271,24 @@ static int bch2_journal_replay_key(struct btree_trans *trans,
|
|||
goto out;
|
||||
|
||||
struct btree_path *path = btree_iter_path(trans, &iter);
|
||||
if (unlikely(!btree_path_node(path, k->level))) {
|
||||
if (unlikely(!btree_path_node(path, k->level) &&
|
||||
!k->allocated)) {
|
||||
struct bch_fs *c = trans->c;
|
||||
|
||||
if (!(c->recovery.passes_complete & (BIT_ULL(BCH_RECOVERY_PASS_scan_for_btree_nodes)|
|
||||
BIT_ULL(BCH_RECOVERY_PASS_check_topology)))) {
|
||||
bch_err(c, "have key in journal replay for btree depth that does not exist, confused");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
#if 0
|
||||
bch2_trans_iter_exit(trans, &iter);
|
||||
bch2_trans_node_iter_init(trans, &iter, k->btree_id, k->k->k.p,
|
||||
BTREE_MAX_DEPTH, 0, iter_flags);
|
||||
ret = bch2_btree_iter_traverse(trans, &iter) ?:
|
||||
bch2_btree_increase_depth(trans, iter.path, 0) ?:
|
||||
-BCH_ERR_transaction_restart_nested;
|
||||
#endif
|
||||
k->overwritten = true;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue