From: Liam R. Howlett Date: Thu, 21 Jul 2022 00:40:28 +0000 (-0400) Subject: maple_tree: Do not inline write slow path X-Git-Tag: howlett/maple/20220722_2~4 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0c8c4fcbaa46a249e91c8c8af7bfff1e074d29dd;p=users%2Fjedix%2Flinux-maple.git maple_tree: Do not inline write slow path Having the slow path inlined causes too much stack usage. Create new function mas_wr_bnode() to write a big node into the tree Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index d5b310e73068e..edd53c41ae9d5 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4297,12 +4297,27 @@ static inline bool mas_wr_append(struct ma_wr_state *wr_mas) return false; } +/* + * mas_wr_bnode() - Slow path for a modification. + * @wr_mas: The write maple state + * + * This is where split, rebalance end up. + */ +static void mas_wr_bnode(struct ma_wr_state *wr_mas) +{ + struct maple_big_node b_node; + + trace_ma_write(__func__, wr_mas->mas, 0, wr_mas->entry); + memset(&b_node, 0, sizeof(struct maple_big_node)); + mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end); + mas_commit_b_node(wr_mas, &b_node, wr_mas->node_end); +} + static inline void mas_wr_modify(struct ma_wr_state *wr_mas) { unsigned char node_slots; unsigned char node_size; struct ma_state *mas = wr_mas->mas; - struct maple_big_node b_node; /* Direct replacement */ if (wr_mas->r_min == mas->index && wr_mas->r_max == mas->last) { @@ -4338,10 +4353,7 @@ static inline void mas_wr_modify(struct ma_wr_state *wr_mas) return; slow_path: - memset(&b_node, 0, sizeof(struct maple_big_node)); - mas_store_b_node(wr_mas, &b_node, wr_mas->offset_end); - trace_ma_write(__func__, mas, 0, wr_mas->entry); - mas_commit_b_node(wr_mas, &b_node, wr_mas->node_end); + mas_wr_bnode(wr_mas); } /*