[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230425110511.11680-3-zhangpeng.00@bytedance.com>
Date: Tue, 25 Apr 2023 19:05:04 +0800
From: Peng Zhang <zhangpeng.00@...edance.com>
To: Liam.Howlett@...cle.com
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, maple-tree@...ts.infradead.org,
Peng Zhang <zhangpeng.00@...edance.com>
Subject: [PATCH 2/9] maple_tree: Make maple state reusable after mas_empty_area()
Make mas->min and mas->max point to a node range instead of a leaf entry
range. This allows mas to still be usable after mas_empty_area() returns.
This currently has no user impact because no one use mas after
mas_empty_area() now.
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
Signed-off-by: Peng Zhang <zhangpeng.00@...edance.com>
---
lib/maple_tree.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 72099b4b32169..aa55c914818a0 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -5320,14 +5320,7 @@ int mas_empty_area(struct ma_state *mas, unsigned long min,
mt = mte_node_type(mas->node);
pivots = ma_pivots(mas_mn(mas), mt);
- if (offset)
- mas->min = pivots[offset - 1] + 1;
-
- if (offset < mt_pivots[mt])
- mas->max = pivots[offset];
-
- if (mas->index < mas->min)
- mas->index = mas->min;
+ mas->index = max(mas->index, mas_safe_min(mas, pivots, offset));
mas->last = mas->index + size - 1;
return 0;
--
2.20.1
Powered by blists - more mailing lists