From 361d88ab12d1fc8f79cb4c16ef8296a85b878787 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 29 Jan 2019 15:28:36 -0500 Subject: [PATCH] maple_tree: Small cleanup of code and comments Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index a07b73462e78..76280416b031 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -526,9 +526,9 @@ static int ma_split(struct ma_state *mas, unsigned char slot, old_parent = mt_parent(mas->node); p_slot = mt_parent_slot(mas->node); p_end = ma_data_end_r64(&old_parent->mr64, UINT_MAX); + ma_encoded_parent(mas); if (p_end >= MAPLE_RANGE64_SLOTS - 1) { /* Must split the parent */ - ma_encoded_parent(mas); split = ma_split(mas, p_slot, p_end, 1); if (mas_is_err(mas)) return 0; @@ -536,8 +536,6 @@ static int ma_split(struct ma_state *mas, unsigned char slot, p_slot -= split; // Split will return the parent. old_parent = mt_to_node(mas->node); - } else { - ma_encoded_parent(mas); } ptype = mt_node_type(mas->node); mas->node = old_parent->mr64.slot[p_slot]; @@ -588,14 +586,13 @@ static int ma_split(struct ma_state *mas, unsigned char slot, ma_link(left, new_parent, p_slot, pivot, ctype); - // Set up maple state for replacement of node. - // Note: old_parent may be the old parent or the full node. + // Set up maple state to replace the parent node in the grandparent. mas->node = mt_mk_node(new_parent, ptype); // Replace the parent node & free the old parent. mt_replace(mas); // Set up the ma_state for the return. Point to the correct node for - // the insert. + // the insert or subsequent split. if (mas->index <= pivot) mas->node = mt_mk_node(left, ctype); else -- 2.50.1