]> 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)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 13 Oct 2019 03:26:31 +0000 (23:26 -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 746a013e10520aead7f52cd0940765eac6222354..429159847fba91857c39562b226ce459c37b4880 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[] = {