From 3fee198c3b741aeea0cde9fe8f839d97a4dddc08 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Wed, 24 Nov 2021 10:59:55 -0500 Subject: [PATCH] maple_tree: mas_spanning_store() cleanup a bit Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 6de4300996b5..30a5599acc9d 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -3853,7 +3853,11 @@ static inline int mas_spanning_store(struct ma_wr_state *wr_mas) if (mas_is_err(mas)) return 0; - /* Set up right side. */ + /* + * Set up right side. Need to get to the next offset after the spanning + * store to ensure it's not NULL and to combine both the next node and + * the node with the start together. + */ r_mas = *mas; /* Avoid overflow, walk to next slot in the tree. */ if (r_mas.last + 1) @@ -3861,7 +3865,7 @@ static inline int mas_spanning_store(struct ma_wr_state *wr_mas) r_mas.index = r_mas.last; r_wr_mas.mas = &r_mas; - mas_wr_walk(&r_wr_mas); + mas_wr_walk_index(&r_wr_mas); r_mas.last = r_mas.index = mas->last; /* Set up left side. */ @@ -3875,8 +3879,7 @@ static inline int mas_spanning_store(struct ma_wr_state *wr_mas) mas->offset = l_mas.offset; mas->index = l_mas.index; mas->last = l_mas.last = r_mas.last; - } else - l_mas.last = mas->last; + } /* Copy l_mas and store the value in b_node. */ b_node.b_end = mas_store_b_node(&l_wr_mas, &b_node, l_wr_mas.node_end); -- 2.50.1