From: Liam R. Howlett Date: Fri, 30 Jan 2026 20:59:29 +0000 (-0500) Subject: maple_tree: add copy_tree_location() helper X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0abff2081983e5dfa7642ab1a794afc0a8417070;p=thirdparty%2Fkernel%2Fstable.git maple_tree: add copy_tree_location() helper 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 Cc: Alice Ryhl Cc: Andrew Ballance Cc: Arnd Bergmann Cc: Christian Kujau Cc: Geert Uytterhoeven Cc: Kuninori Morimoto Cc: Matthew Wilcox (Oracle) Cc: SeongJae Park Cc: Sidhartha Kumar Cc: Suren Baghdasaryan Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 7ce7c0a33943..86072bfc2419 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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; }