diff mbox series

[6/7] maple_tree: always need to update max of new left node

Message ID 20241127012753.3393-7-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series spanning write related cleanup | expand

Commit Message

Wei Yang Nov. 27, 2024, 1:27 a.m. UTC
If (split == mast->bn->b_end), this means we would put all data from
bnode to new left. And the original data source of bnode is orig_l +
orig_r, whose range is [orig_l->min, orig_r->max]

So we can always update max of new left node.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
CC: Liam R. Howlett <Liam.Howlett@Oracle.com>
CC: Sidhartha Kumar <sidhartha.kumar@oracle.com>
CC: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
---
 lib/maple_tree.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 56e9857ce681..4ba9ae68c0a9 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -2664,19 +2664,12 @@  static inline void mast_cp_to_nodes(struct maple_subtree_state *mast,
 	struct maple_enode *left, struct maple_enode *middle,
 	struct maple_enode *right, unsigned char split, unsigned char mid_split)
 {
-	bool new_lmax = true;
-
 	mas_node_or_none(mast->l, left);
 	mas_node_or_none(mast->m, middle);
 	mas_node_or_none(mast->r, right);
 
 	mast->l->min = mast->orig_l->min;
-	if (split == mast->bn->b_end) {
-		mast->l->max = mast->orig_r->max;
-		new_lmax = false;
-	}
-
-	mab_mas_cp(mast->bn, 0, split, mast->l, new_lmax);
+	mab_mas_cp(mast->bn, 0, split, mast->l, true);
 
 	if (middle) {
 		mab_mas_cp(mast->bn, 1 + split, mid_split, mast->m, true);