diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-15 21:52:12 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:46 -0400 |
commit | 4fcdd6ec345e1aeed23fbdbe53d62965c1a79b99 (patch) | |
tree | cfe98f33f2222015fb944dfa01c944c6b5e89234 /fs/bcachefs/bkey_sort.c | |
parent | 0f35e0860a73a35e8c3aa1afebc45e75eb2fbae6 (diff) |
bcachefs: Btree split improvement
This improves the bkey_format calculation when splitting btree nodes.
Previously, we'd use a format calculated for the original node for the
lower of the two new nodes.
This was particularly bad on sequential insertions, where we iteratively
split the last btree node, whos format has to include KEY_MAX.
Now, we calculate formats precisely for the keys the two new nodes will
contain. This also should make splitting a bit more efficient, since
we're only copying keys once (from the original node to the new node,
instead of new node, replacement node, then upper split).
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bkey_sort.c')
-rw-r--r-- | fs/bcachefs/bkey_sort.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/bcachefs/bkey_sort.c b/fs/bcachefs/bkey_sort.c index be0d4bc1afd3..557a79cad986 100644 --- a/fs/bcachefs/bkey_sort.c +++ b/fs/bcachefs/bkey_sort.c @@ -144,6 +144,8 @@ bch2_sort_repack(struct bset *dst, struct btree *src, else bch2_bkey_unpack(src, (void *) out, in); + out->needs_whiteout = false; + btree_keys_account_key_add(&nr, 0, out); out = bkey_next(out); } |