From: Liam R. Howlett Date: Wed, 24 Sep 2025 14:22:43 +0000 (-0400) Subject: add comment to data_fits and reduce branching X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d3f5f67a7fd4fde39d1a84548824c6de31c36b36;p=users%2Fjedix%2Flinux-maple.git add comment to data_fits and reduce branching Signed-off-by: Liam R. Howlett --- 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; }