diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-03-26 20:10:59 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:57 -0400 |
commit | c7e04e22e000d3d9c2c0ed00cd444b3b8a26cf1a (patch) | |
tree | 6eab0177fd091008b4a1253e027b88c57e9066cb /fs/bcachefs/bset.c | |
parent | 2da5d000b91e0407dedc3baa35cf7c36a0392ff2 (diff) | |
download | linux-c7e04e22e000d3d9c2c0ed00cd444b3b8a26cf1a.tar.gz linux-c7e04e22e000d3d9c2c0ed00cd444b3b8a26cf1a.tar.bz2 linux-c7e04e22e000d3d9c2c0ed00cd444b3b8a26cf1a.zip |
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 <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bset.c')
-rw-r--r-- | fs/bcachefs/bset.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c index 59f613560b65..34fd2307a320 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) |