Commit 87cb0239 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: btree node scan: handle encrypted nodes

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 031ad9e7
...@@ -133,9 +133,19 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca, ...@@ -133,9 +133,19 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca,
if (le64_to_cpu(bn->magic) != bset_magic(c)) if (le64_to_cpu(bn->magic) != bset_magic(c))
return; return;
if (bch2_csum_type_is_encryption(BSET_CSUM_TYPE(&bn->keys))) {
struct nonce nonce = btree_nonce(&bn->keys, 0);
unsigned bytes = (void *) &bn->keys - (void *) &bn->flags;
bch2_encrypt(c, BSET_CSUM_TYPE(&bn->keys), nonce, &bn->flags, bytes);
}
if (btree_id_is_alloc(BTREE_NODE_ID(bn))) if (btree_id_is_alloc(BTREE_NODE_ID(bn)))
return; return;
if (BTREE_NODE_LEVEL(bn) >= BTREE_MAX_DEPTH)
return;
rcu_read_lock(); rcu_read_lock();
struct found_btree_node n = { struct found_btree_node n = {
.btree_id = BTREE_NODE_ID(bn), .btree_id = BTREE_NODE_ID(bn),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment