From: Liam R. Howlett Date: Mon, 7 Dec 2020 20:59:37 +0000 (-0500) Subject: maple_tree: Use mas_data_end in mas_next_sibling() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cd8b08f03258577c1ab8ff4e1530b440b2acfcc0;p=users%2Fjedix%2Flinux-maple.git maple_tree: Use mas_data_end in mas_next_sibling() This should be faster for allocation ranges. Signed-off-by: Liam R. Howlett --- 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))