]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Add copy_tree_location() helper
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 14 Oct 2025 20:11:30 +0000 (16:11 -0400)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 14 Oct 2025 20:11:30 +0000 (16:11 -0400)
Extract the copying of the tree location from one maple state to another
into its own function.  This is used more later.

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

index b32a6d4caa14244bdca654070e9d04812c8e7274..645a73211ec543027c1f09b82bcfef94a8c93dc2 100644 (file)
@@ -3718,6 +3718,17 @@ static bool spanning_ascend(struct maple_copy *cp, struct ma_state *mas,
        return true;
 }
 
+static inline
+void copy_tree_location(const struct ma_state *src, struct ma_state *dst)
+{
+       dst->node = src->node;
+       dst->offset = src->offset;
+       dst->min = src->min;
+       dst->max = src->max;
+       dst->end = src->end;
+       dst->depth = src->depth;
+}
+
 /*
  * rebalance_ascend() - Ascend the tree and set up for the next loop - if
  * necessary
@@ -3757,12 +3768,7 @@ static inline bool rebalance_ascend(struct maple_copy *cp,
        }
 
        cp->height++;
-       mas->node = parent->node;
-       mas->offset = parent->offset;
-       mas->min = parent->min;
-       mas->max = parent->max;
-       mas->end = parent->end;
-       mas->depth = parent->depth;
+       copy_tree_location(parent, mas);
        wr_mas_setup(wr_mas, mas);
        return true;
 }