]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Fix test check_find
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 13 Oct 2019 03:23:46 +0000 (23:23 -0400)
committerLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 30 Oct 2020 18:56:26 +0000 (14:56 -0400)
Lock the tree before beginning the iteration and unlock it after we've
finished.  Also destroy the tree so subsequent users of the tree aren't
confused by the detritus from this test.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
lib/test_maple_tree.c

index be76a04d252634194c4d3e4762703cce311315aa..87e6bd90350856fbeb5cc58e55bd3f03e7f3cecc 100644 (file)
@@ -430,8 +430,8 @@ static noinline void check_find(struct maple_tree *mt)
 
        /* Test mas_pause */
        val = 0;
-       mas_reset(&mas);
-       mas.index = val;
+       mas_set(&mas, val);
+       mas_lock(&mas);
        mas_for_each(&mas, entry, ULONG_MAX) {
                if (val != 64)
                        MT_BUG_ON(mt, xa_mk_value(val) != entry);
@@ -448,6 +448,7 @@ static noinline void check_find(struct maple_tree *mt)
                        mas_lock(&mas);
                }
        }
+       mas_unlock(&mas);
 
        val = 0;
        max = 300; // A value big enough to include XA_ZERO_ENTRY at 64.
@@ -461,7 +462,7 @@ static noinline void check_find(struct maple_tree *mt)
                        val = 1;
        }
 
-
+       mtree_destroy(mt);
 }
 
 
@@ -941,6 +942,7 @@ static noinline void check_alloc_range(struct maple_tree *mt)
 
        mtree_destroy(mt);
 }
+
 static noinline void check_ranges(struct maple_tree *mt)
 {
        unsigned long r[] = {