From: Liam R. Howlett Date: Thu, 10 Dec 2020 17:16:54 +0000 (-0500) Subject: maple_tree: Don't pass contents to expand_root() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5d9b5febaae430b6bbadf11ea28daf58c574d96f;p=users%2Fjedix%2Flinux-maple.git maple_tree: Don't pass contents to expand_root() it's not used Signed-off-by: Liam R. Howlett --- diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 5bd61cd196e2..7454c42b8bd4 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2917,15 +2917,15 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) mas_node_count(mas, 1); - if (mas_is_err(mas)) + if (unlikely(mas_is_err(mas))) return 0; node = mas_pop_node(mas); pivots = ma_pivots(node, type); slots = ma_slots(node, type); - mas->node = mt_mk_node(node, type); - mas_mn(mas)->parent = ma_parent_ptr( + node->parent = ma_parent_ptr( ((unsigned long)mas->tree | MA_ROOT_PARENT)); + mas->node = mt_mk_node(node, type); if (contents) slots[slot++] = contents; @@ -2937,15 +2937,14 @@ static inline int mas_root_expand(struct ma_state *mas, void *entry) slots[slot] = entry; pivots[slot++] = mas->last; - /* swap the new root into the tree */ - rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node)); mas->depth = 1; mas_set_height(mas); + /* swap the new root into the tree */ + rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node)); return slot; } -static inline int ma_root_ptr(struct ma_state *mas, void *entry, - void *contents, bool overwrite) +static inline int ma_root_ptr(struct ma_state *mas, void *entry, bool overwrite) { int ret = 1; @@ -2953,12 +2952,9 @@ static inline int ma_root_ptr(struct ma_state *mas, void *entry, return 0; if (mas_root(mas) && mas->last == 0) { - contents = mas_root_locked(mas); if (!overwrite) goto exists; - } else { - contents = NULL; - } + } else if (mas->last != 0) ret = mas_root_expand(mas, entry); @@ -3476,7 +3472,7 @@ static inline void *_mas_store(struct ma_state *mas, void *entry, bool overwrite if (mas_start(mas) || mas_is_none(mas) || mas->node == MAS_ROOT) { - ret = ma_root_ptr(mas, entry, content, overwrite); + ret = ma_root_ptr(mas, entry, overwrite); if (mas_is_err(mas)) return NULL; if (ret)