From cd8b08f03258577c1ab8ff4e1530b440b2acfcc0 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Mon, 7 Dec 2020 15:59:37 -0500 Subject: [PATCH] maple_tree: Use mas_data_end in mas_next_sibling() This should be faster for allocation ranges. Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index c5cecbec4a66..2b012ec9b1b8 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1795,6 +1795,7 @@ static inline bool mas_prev_sibling(struct ma_state *mas) */ static inline bool mas_next_sibling(struct ma_state *mas) { + unsigned char end; MA_STATE(parent, mas->tree, mas->index, mas->last); if (mte_is_root(mas->node)) @@ -1802,9 +1803,9 @@ static inline bool mas_next_sibling(struct ma_state *mas) mas_dup_state(&parent, mas); mas_ascend(&parent); + end = mas_data_end(&parent); parent.offset = mte_parent_slot(mas->node) + 1; - - if (parent.offset == mt_slot_count(parent.node)) + if (parent.offset > end) return false; if (!mas_get_slot(&parent, parent.offset)) -- 2.50.1