Skip to content

Commit d2cb6b2

Browse files
author
Kent Overstreet
committed
bcachefs: Simplify btree key cache fill path
Don't allocate the new bkey_cached until after we've done the btree lookup; this means we can kill bkey_cached.valid. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 39d5d82 commit d2cb6b2

File tree

3 files changed

+122
-205
lines changed

3 files changed

+122
-205
lines changed

fs/bcachefs/btree_iter.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,13 +1800,12 @@ struct bkey_s_c bch2_btree_path_peek_slot(struct btree_path *path, struct bkey *
18001800
goto hole;
18011801
} else {
18021802
struct bkey_cached *ck = (void *) path->l[0].b;
1803-
1804-
EBUG_ON(ck &&
1805-
(path->btree_id != ck->key.btree_id ||
1806-
!bkey_eq(path->pos, ck->key.pos)));
1807-
if (!ck || !ck->valid)
1803+
if (!ck)
18081804
return bkey_s_c_null;
18091805

1806+
EBUG_ON(path->btree_id != ck->key.btree_id ||
1807+
!bkey_eq(path->pos, ck->key.pos));
1808+
18101809
*u = ck->k->k;
18111810
k = bkey_i_to_s_c(ck->k);
18121811
}

0 commit comments

Comments
 (0)