]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
maple_tree: add copy_tree_location() helper
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Fri, 30 Jan 2026 20:59:29 +0000 (15:59 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:52:56 +0000 (13:52 -0700)
Extract the copying of the tree location from one maple state to another
into its own function.  This is used more later.

Link: https://lkml.kernel.org/r/20260130205935.2559335-25-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Alice Ryhl <aliceryhl@google.com>
Cc: Andrew Ballance <andrewjballance@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Kujau <lists@nerdbynature.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c

index 7ce7c0a339433e351147c86df7561ef06c69ef31..86072bfc2419c7ef409b60c71aa87a18b73faed6 100644 (file)
@@ -3531,6 +3531,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
@@ -3570,12 +3581,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;
 }