Commit c7e04e22 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix building of aux search trees

We weren't packing the min/max keys, which was a major oversight and
completely disabled generating bkey_floats for adjacent nodes.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2da5d000
......@@ -674,16 +674,20 @@ static void make_bfloat(struct btree *b, struct bset_tree *t,
if (is_power_of_2(j) &&
!min_key->u64s) {
k = (void *) min_key;
bkey_init(&k->k);
k->k.p = b->data->min_key;
if (!bkey_pack_pos(min_key, b->data->min_key, b)) {
k = (void *) min_key;
bkey_init(&k->k);
k->k.p = b->data->min_key;
}
}
if (is_power_of_2(j + 1) &&
!max_key->u64s) {
k = (void *) max_key;
bkey_init(&k->k);
k->k.p = t->max_key;
if (!bkey_pack_pos(max_key, b->data->max_key, b)) {
k = (void *) max_key;
bkey_init(&k->k);
k->k.p = t->max_key;
}
}
__make_bfloat(b, t, j, min_key, max_key);
......@@ -768,10 +772,15 @@ static noinline void __build_ro_aux_tree(struct btree *b, struct bset_tree *t)
t->max_key = bkey_unpack_pos(b, prev);
bkey_init(&min_key.k);
min_key.k.p = b->data->min_key;
bkey_init(&max_key.k);
max_key.k.p = t->max_key;
if (!bkey_pack_pos(bkey_to_packed(&min_key), b->data->min_key, b)) {
bkey_init(&min_key.k);
min_key.k.p = b->data->min_key;
}
if (!bkey_pack_pos(bkey_to_packed(&max_key), b->data->max_key, b)) {
bkey_init(&max_key.k);
max_key.k.p = t->max_key;
}
/* Then we build the tree */
eytzinger1_for_each(j, t->size)
......
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