diff options
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 6f09c845187e..4676c0a1eeca 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c | |||
@@ -633,6 +633,15 @@ static noinline void check_xa_alloc(void) | |||
633 | GFP_KERNEL) != -ENOSPC); | 633 | GFP_KERNEL) != -ENOSPC); |
634 | XA_BUG_ON(&xa0, id != 0xffffffffU); | 634 | XA_BUG_ON(&xa0, id != 0xffffffffU); |
635 | xa_destroy(&xa0); | 635 | xa_destroy(&xa0); |
636 | |||
637 | id = 10; | ||
638 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, 5, xa_mk_index(id), | ||
639 | GFP_KERNEL) != -ENOSPC); | ||
640 | XA_BUG_ON(&xa0, xa_store_index(&xa0, 3, GFP_KERNEL) != 0); | ||
641 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, 5, xa_mk_index(id), | ||
642 | GFP_KERNEL) != -ENOSPC); | ||
643 | xa_erase_index(&xa0, 3); | ||
644 | XA_BUG_ON(&xa0, !xa_empty(&xa0)); | ||
636 | } | 645 | } |
637 | 646 | ||
638 | static noinline void __check_store_iter(struct xarray *xa, unsigned long start, | 647 | static noinline void __check_store_iter(struct xarray *xa, unsigned long start, |
@@ -822,10 +831,34 @@ static noinline void check_find_2(struct xarray *xa) | |||
822 | xa_destroy(xa); | 831 | xa_destroy(xa); |
823 | } | 832 | } |
824 | 833 | ||
834 | static noinline void check_find_3(struct xarray *xa) | ||
835 | { | ||
836 | XA_STATE(xas, xa, 0); | ||
837 | unsigned long i, j, k; | ||
838 | void *entry; | ||
839 | |||
840 | for (i = 0; i < 100; i++) { | ||
841 | for (j = 0; j < 100; j++) { | ||
842 | for (k = 0; k < 100; k++) { | ||
843 | xas_set(&xas, j); | ||
844 | xas_for_each_marked(&xas, entry, k, XA_MARK_0) | ||
845 | ; | ||
846 | if (j > k) | ||
847 | XA_BUG_ON(xa, | ||
848 | xas.xa_node != XAS_RESTART); | ||
849 | } | ||
850 | } | ||
851 | xa_store_index(xa, i, GFP_KERNEL); | ||
852 | xa_set_mark(xa, i, XA_MARK_0); | ||
853 | } | ||
854 | xa_destroy(xa); | ||
855 | } | ||
856 | |||
825 | static noinline void check_find(struct xarray *xa) | 857 | static noinline void check_find(struct xarray *xa) |
826 | { | 858 | { |
827 | check_find_1(xa); | 859 | check_find_1(xa); |
828 | check_find_2(xa); | 860 | check_find_2(xa); |
861 | check_find_3(xa); | ||
829 | check_multi_find(xa); | 862 | check_multi_find(xa); |
830 | check_multi_find_2(xa); | 863 | check_multi_find_2(xa); |
831 | } | 864 | } |