From d3f5f67a7fd4fde39d1a84548824c6de31c36b36 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 24 Sep 2025 10:22:43 -0400 Subject: [PATCH] add comment to data_fits and reduce branching Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 62dda0474f1e..80fc52d785f6 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2445,16 +2445,16 @@ static bool data_fits(struct ma_state *sib, struct ma_state *mas, * to end to convert the index to a size means that the below * calculation should be <=, but we want to keep an extra space in nodes * to reduce jitter. + * + * Note that it is still possible to get a full node on the left by the + * NULL landing exactly on the split. The NULL ending of a node happens + * in the multi_dst_setup() function, where we will either increase the + * split by one or decrease it by one, if possible. In the case of + * split (this case), it is always possible to shift the spilt by one - + * again because there is at least one slot free by the below checking. */ - - - if (ma_is_leaf(type)) { - if (new_data < space) - return true; - } else { - if (new_data < space) - return true; - } + if (new_data < space) + return true; return false; } -- 2.51.0