From eb87b19808beedcb8e3ba30306b4201d57bd586b Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Mon, 1 Mar 2021 14:34:11 -0500 Subject: [PATCH] lib/maple_tree: Clean up node allocations Remove extra parenthesis, etc Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index e065b85792607..70846dbeb7967 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1028,16 +1028,15 @@ static inline void mas_push_node(struct ma_state *mas, struct maple_enode *used) } reuse->total = 1; - if ((head) && !(((unsigned long)head & 0x1))) { + if ((head) && !((unsigned long)head & 0x1)) { head->request_count = 0; reuse->slot[0] = head; reuse->total += head->total; } - reuse->node_count = 0; mas->alloc = reuse; done: - if (requested) + if (requested > 1) mas_set_alloc_req(mas, requested - 1); } @@ -1084,8 +1083,8 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp) max_req -= offset; } - count = min(requested, max_req); - count = mt_alloc_bulk(gfp, count, slots); + count = mt_alloc_bulk(gfp, min(requested, max_req), + slots); if (!count) goto nomem; @@ -5299,9 +5298,9 @@ void mas_destroy(struct ma_state *mas) } mas->mas_flags &= ~MA_STATE_BULK; - while (mas->alloc && !(((unsigned long)mas->alloc & 0x1))) { + while (mas->alloc && !((unsigned long)mas->alloc & 0x1)) { node = mas->alloc; - mas->alloc = mas->alloc->slot[0]; + mas->alloc = node->slot[0]; if (node->node_count > 0) mt_free_bulk(node->node_count, (void __rcu **)&node->slot[1]); -- 2.50.1