aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_xarray.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r--lib/test_xarray.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c
index d30fd907a3dd..6f09c845187e 100644
--- a/lib/test_xarray.c
+++ b/lib/test_xarray.c
@@ -476,6 +476,32 @@ static noinline void check_multi_store_2(struct xarray *xa, unsigned long index,
476 xas_unlock(&xas); 476 xas_unlock(&xas);
477 XA_BUG_ON(xa, !xa_empty(xa)); 477 XA_BUG_ON(xa, !xa_empty(xa));
478} 478}
479
480static noinline void check_multi_store_3(struct xarray *xa, unsigned long index,
481 unsigned int order)
482{
483 XA_STATE(xas, xa, 0);
484 void *entry;
485 int n = 0;
486
487 xa_store_order(xa, index, order, xa_mk_index(index), GFP_KERNEL);
488
489 xas_lock(&xas);
490 xas_for_each(&xas, entry, ULONG_MAX) {
491 XA_BUG_ON(xa, entry != xa_mk_index(index));
492 n++;
493 }
494 XA_BUG_ON(xa, n != 1);
495 xas_set(&xas, index + 1);
496 xas_for_each(&xas, entry, ULONG_MAX) {
497 XA_BUG_ON(xa, entry != xa_mk_index(index));
498 n++;
499 }
500 XA_BUG_ON(xa, n != 2);
501 xas_unlock(&xas);
502
503 xa_destroy(xa);
504}
479#endif 505#endif
480 506
481static noinline void check_multi_store(struct xarray *xa) 507static noinline void check_multi_store(struct xarray *xa)
@@ -550,6 +576,11 @@ static noinline void check_multi_store(struct xarray *xa)
550 check_multi_store_1(xa, (1UL << i) + 1, i); 576 check_multi_store_1(xa, (1UL << i) + 1, i);
551 } 577 }
552 check_multi_store_2(xa, 4095, 9); 578 check_multi_store_2(xa, 4095, 9);
579
580 for (i = 1; i < 20; i++) {
581 check_multi_store_3(xa, 0, i);
582 check_multi_store_3(xa, 1UL << i, i);
583 }
553#endif 584#endif
554} 585}
555 586