mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
bcachefs: Change btree split threshold to be in u64s
This fixes a bug with very small btree nodes where splitting would end up with one of the new nodes empty. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
d98a5e3945
commit
5525f632dc
2 changed files with 2 additions and 2 deletions
|
@ -75,7 +75,7 @@ static inline unsigned btree_blocks(struct bch_fs *c)
|
||||||
return c->opts.btree_node_size >> c->block_bits;
|
return c->opts.btree_node_size >> c->block_bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BTREE_SPLIT_THRESHOLD(c) (btree_blocks(c) * 3 / 4)
|
#define BTREE_SPLIT_THRESHOLD(c) (btree_max_u64s(c) * 3 / 4)
|
||||||
|
|
||||||
#define BTREE_FOREGROUND_MERGE_THRESHOLD(c) (btree_max_u64s(c) * 1 / 3)
|
#define BTREE_FOREGROUND_MERGE_THRESHOLD(c) (btree_max_u64s(c) * 1 / 3)
|
||||||
#define BTREE_FOREGROUND_MERGE_HYSTERESIS(c) \
|
#define BTREE_FOREGROUND_MERGE_HYSTERESIS(c) \
|
||||||
|
|
|
@ -1385,7 +1385,7 @@ static void btree_split(struct btree_update *as, struct btree *b,
|
||||||
if (keys)
|
if (keys)
|
||||||
btree_split_insert_keys(as, n1, iter, keys);
|
btree_split_insert_keys(as, n1, iter, keys);
|
||||||
|
|
||||||
if (vstruct_blocks(n1->data, c->block_bits) > BTREE_SPLIT_THRESHOLD(c)) {
|
if (bset_u64s(&n1->set[0]) > BTREE_SPLIT_THRESHOLD(c)) {
|
||||||
trace_btree_split(c, b);
|
trace_btree_split(c, b);
|
||||||
|
|
||||||
n2 = __btree_split_node(as, n1, iter);
|
n2 = __btree_split_node(as, n1, iter);
|
||||||
|
|
Loading…
Reference in a new issue