]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
lib/maple_tree: Clean up node allocations
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 1 Mar 2021 19:34:11 +0000 (14:34 -0500)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Mon, 1 Mar 2021 19:34:11 +0000 (14:34 -0500)
Remove extra parenthesis, etc

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
lib/maple_tree.c

index e065b85792607b7e70a219ebfa10e2c3dc44a58e..70846dbeb796708d6bd46b832d40f2152919f584 100644 (file)
@@ -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]);