History

bcachefs: btree_node_scan: don't re-read before initializing found_btree_node

If the btree node is encrypted, this caused us to initialize found_btree_node from the encrypted header.

Kent Overstreet committed 1 year ago

Commit eef91701 parent 89edfcf1 file · +8 −8Browse files

Unified · Split

fs/bcachefs/btree_node_scan.c+8−8
@@ -168,14 +168,6 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca, · 167 unmodified lines
168168 if (BTREE_NODE_ID(bn) >= BTREE_ID_NR_MAX)
169169 return;
170170
171− bio_reset(bio, ca->disk_sb.bdev, REQ_OP_READ);
172− bio->bi_iter.bi_sector = offset;
173− bch2_bio_map(bio, b->data, c->opts.btree_node_size);
174−
175− submit_time = local_clock();
176− submit_bio_wait(bio);
177− bch2_account_io_completion(ca, BCH_MEMBER_ERROR_read, submit_time, !bio->bi_status);
178−
179171 rcu_read_lock();
180172 struct found_btree_node n = {
181173 .btree_id = BTREE_NODE_ID(bn),
@@ -192,6 +184,14 @@ static void try_read_btree_node(struct find_btree_nodes *f, struct bch_dev *ca, · 10 unmodified lines
192184 };
193185 rcu_read_unlock();
194186
187+ bio_reset(bio, ca->disk_sb.bdev, REQ_OP_READ);
188+ bio->bi_iter.bi_sector = offset;
189+ bch2_bio_map(bio, b->data, c->opts.btree_node_size);
190+
191+ submit_time = local_clock();
192+ submit_bio_wait(bio);
193+ bch2_account_io_completion(ca, BCH_MEMBER_ERROR_read, submit_time, !bio->bi_status);
194+
195195 found_btree_node_to_key(&b->key, &n);
196196
197197 CLASS(printbuf, buf)();