]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Optimize mast_sibling_rebalance_right()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 7 Dec 2020 21:00:51 +0000 (16:00 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Tue, 5 Jan 2021 17:33:35 +0000 (12:33 -0500)
Only set the data when needed

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index 76e13b804560d676629995d0610303f61be09001..d723576e9d37597de88c84a82f3c32d221e83346 100644 (file)
@@ -1926,17 +1926,21 @@ static inline bool mast_sibling_rebalance_left(struct maple_subtree_state *mast)
  */
 static inline bool mast_sibling_rebalance_right(struct maple_subtree_state *mast)
 {
-       struct maple_enode *old_r = mast->orig_r->node;
-       struct maple_enode *old_l = mast->orig_l->node;
+       struct maple_enode *old_r;
+       struct maple_enode *old_l;
 
+       old_r = mast->orig_r->node;
        if (mas_next_sibling(mast->orig_r)) {
                mast_rebalance_next(mast, old_r);
                return true;
        }
+
+       old_l = mast->orig_l->node;
        if (mas_prev_sibling(mast->orig_l)) {
                mast_rebalance_prev(mast, old_l);
                return true;
        }
+
        return false;
 }