From: Kent Overstreet Date: Sat, 27 Mar 2021 00:10:59 +0000 (-0400) Subject: bcachefs: Fix building of aux search trees X-Git-Tag: v6.7-rc1~201^2~1707 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7e04e22e000d3d9c2c0ed00cd444b3b8a26cf1a;p=thirdparty%2Fkernel%2Flinux.git 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: Kent Overstreet Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c index 59f613560b658..34fd2307a3205 100644 --- a/fs/bcachefs/bset.c +++ b/fs/bcachefs/bset.c @@ -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 @@ retry: 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)