From: Liam R. Howlett Date: Mon, 7 Dec 2020 00:55:55 +0000 (-0500) Subject: maple_tree: Use a variable for b_node->b_end X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=06afef92f442d0b5c656fbd5c0718d5dfee29a9e;p=users%2Fjedix%2Flinux-maple.git maple_tree: Use a variable for b_node->b_end Makes cleaner code and less dereferences Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 653378434c0e..b33dcfec3789 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1500,7 +1500,8 @@ static inline int mab_calc_split(struct ma_state *mas, struct maple_big_node *b_node, unsigned char *mid_split) { - int split = b_node->b_end / 2; // Assume equal split. + unsigned char b_end = b_node->b_end; + int split = b_end / 2; // Assume equal split. unsigned char min, slot_count = mt_slots[b_node->type]; if (unlikely((mas->mas_flags & MA_STATE_BULK))) { @@ -1508,9 +1509,9 @@ static inline int mab_calc_split(struct ma_state *mas, if (ma_is_leaf(b_node->type)) min = 2; else - return b_node->b_end - mt_min_slots[b_node->type]; + return b_end - mt_min_slots[b_node->type]; - split = b_node->b_end - min; + split = b_end - min; mas->mas_flags |= MA_STATE_REBALANCE; if (!b_node->slot[split]) split--; @@ -1518,7 +1519,7 @@ static inline int mab_calc_split(struct ma_state *mas, } if (unlikely(mab_middle_node(b_node, split, slot_count))) { - split = b_node->b_end / 3; + split = b_end / 3; *mid_split = split * 2; } else { min = mt_min_slots[b_node->type]; @@ -1529,8 +1530,7 @@ static inline int mab_calc_split(struct ma_state *mas, * NOTE: mt_min_slots is 1 based, b_end and split are zero. */ while (((b_node->pivot[split] - b_node->min) < slot_count - 1) && - (split < slot_count - 1) && - (b_node->b_end - split > min)) + (split < slot_count - 1) && (b_end - split > min)) split++; }