diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-11-05 13:19:54 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-12-06 09:25:15 -0500 |
commit | b7677a132a4c2ff877986c5b30f9427127b9897a (patch) | |
tree | d93228d64009d3398ebdffe20515c7152db0950d /lib/test_xarray.c | |
parent | 55f3f7eab75c10d9b33d122670b5935ab64db50f (diff) |
XArray tests: Handle larger indices more elegantly
xa_mk_value() only handles values up to LONG_MAX. I successfully hid
that inside xa_store_index() and xa_erase_index(), but it turned out I
also needed it for testing xa_alloc() on 32-bit machines. So extract
xa_mk_index() from the above two functions, and convert the non-constant
users of xa_mk_value() to xa_mk_index().
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 91 |
1 files changed, 48 insertions, 43 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 0598e86af8fc..d30fd907a3dd 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c | |||
@@ -28,23 +28,28 @@ void xa_dump(const struct xarray *xa) { } | |||
28 | } while (0) | 28 | } while (0) |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | static void *xa_mk_index(unsigned long index) | ||
32 | { | ||
33 | return xa_mk_value(index & LONG_MAX); | ||
34 | } | ||
35 | |||
31 | static void *xa_store_index(struct xarray *xa, unsigned long index, gfp_t gfp) | 36 | static void *xa_store_index(struct xarray *xa, unsigned long index, gfp_t gfp) |
32 | { | 37 | { |
33 | return xa_store(xa, index, xa_mk_value(index & LONG_MAX), gfp); | 38 | return xa_store(xa, index, xa_mk_index(index), gfp); |
34 | } | 39 | } |
35 | 40 | ||
36 | static void xa_alloc_index(struct xarray *xa, unsigned long index, gfp_t gfp) | 41 | static void xa_alloc_index(struct xarray *xa, unsigned long index, gfp_t gfp) |
37 | { | 42 | { |
38 | u32 id = 0; | 43 | u32 id = 0; |
39 | 44 | ||
40 | XA_BUG_ON(xa, xa_alloc(xa, &id, UINT_MAX, xa_mk_value(index & LONG_MAX), | 45 | XA_BUG_ON(xa, xa_alloc(xa, &id, UINT_MAX, xa_mk_index(index), |
41 | gfp) != 0); | 46 | gfp) != 0); |
42 | XA_BUG_ON(xa, id != index); | 47 | XA_BUG_ON(xa, id != index); |
43 | } | 48 | } |
44 | 49 | ||
45 | static void xa_erase_index(struct xarray *xa, unsigned long index) | 50 | static void xa_erase_index(struct xarray *xa, unsigned long index) |
46 | { | 51 | { |
47 | XA_BUG_ON(xa, xa_erase(xa, index) != xa_mk_value(index & LONG_MAX)); | 52 | XA_BUG_ON(xa, xa_erase(xa, index) != xa_mk_index(index)); |
48 | XA_BUG_ON(xa, xa_load(xa, index) != NULL); | 53 | XA_BUG_ON(xa, xa_load(xa, index) != NULL); |
49 | } | 54 | } |
50 | 55 | ||
@@ -118,7 +123,7 @@ static noinline void check_xas_retry(struct xarray *xa) | |||
118 | 123 | ||
119 | xas_set(&xas, 0); | 124 | xas_set(&xas, 0); |
120 | xas_for_each(&xas, entry, ULONG_MAX) { | 125 | xas_for_each(&xas, entry, ULONG_MAX) { |
121 | xas_store(&xas, xa_mk_value(xas.xa_index)); | 126 | xas_store(&xas, xa_mk_index(xas.xa_index)); |
122 | } | 127 | } |
123 | xas_unlock(&xas); | 128 | xas_unlock(&xas); |
124 | 129 | ||
@@ -196,7 +201,7 @@ static noinline void check_xa_mark_1(struct xarray *xa, unsigned long index) | |||
196 | XA_BUG_ON(xa, xa_store_index(xa, index + 2, GFP_KERNEL)); | 201 | XA_BUG_ON(xa, xa_store_index(xa, index + 2, GFP_KERNEL)); |
197 | xa_set_mark(xa, index + 2, XA_MARK_1); | 202 | xa_set_mark(xa, index + 2, XA_MARK_1); |
198 | XA_BUG_ON(xa, xa_store_index(xa, next, GFP_KERNEL)); | 203 | XA_BUG_ON(xa, xa_store_index(xa, next, GFP_KERNEL)); |
199 | xa_store_order(xa, index, order, xa_mk_value(index), | 204 | xa_store_order(xa, index, order, xa_mk_index(index), |
200 | GFP_KERNEL); | 205 | GFP_KERNEL); |
201 | for (i = base; i < next; i++) { | 206 | for (i = base; i < next; i++) { |
202 | XA_STATE(xas, xa, i); | 207 | XA_STATE(xas, xa, i); |
@@ -405,7 +410,7 @@ static noinline void check_xas_erase(struct xarray *xa) | |||
405 | xas_set(&xas, j); | 410 | xas_set(&xas, j); |
406 | do { | 411 | do { |
407 | xas_lock(&xas); | 412 | xas_lock(&xas); |
408 | xas_store(&xas, xa_mk_value(j)); | 413 | xas_store(&xas, xa_mk_index(j)); |
409 | xas_unlock(&xas); | 414 | xas_unlock(&xas); |
410 | } while (xas_nomem(&xas, GFP_KERNEL)); | 415 | } while (xas_nomem(&xas, GFP_KERNEL)); |
411 | } | 416 | } |
@@ -423,7 +428,7 @@ static noinline void check_xas_erase(struct xarray *xa) | |||
423 | xas_set(&xas, 0); | 428 | xas_set(&xas, 0); |
424 | j = i; | 429 | j = i; |
425 | xas_for_each(&xas, entry, ULONG_MAX) { | 430 | xas_for_each(&xas, entry, ULONG_MAX) { |
426 | XA_BUG_ON(xa, entry != xa_mk_value(j)); | 431 | XA_BUG_ON(xa, entry != xa_mk_index(j)); |
427 | xas_store(&xas, NULL); | 432 | xas_store(&xas, NULL); |
428 | j++; | 433 | j++; |
429 | } | 434 | } |
@@ -440,17 +445,17 @@ static noinline void check_multi_store_1(struct xarray *xa, unsigned long index, | |||
440 | unsigned long min = index & ~((1UL << order) - 1); | 445 | unsigned long min = index & ~((1UL << order) - 1); |
441 | unsigned long max = min + (1UL << order); | 446 | unsigned long max = min + (1UL << order); |
442 | 447 | ||
443 | xa_store_order(xa, index, order, xa_mk_value(index), GFP_KERNEL); | 448 | xa_store_order(xa, index, order, xa_mk_index(index), GFP_KERNEL); |
444 | XA_BUG_ON(xa, xa_load(xa, min) != xa_mk_value(index)); | 449 | XA_BUG_ON(xa, xa_load(xa, min) != xa_mk_index(index)); |
445 | XA_BUG_ON(xa, xa_load(xa, max - 1) != xa_mk_value(index)); | 450 | XA_BUG_ON(xa, xa_load(xa, max - 1) != xa_mk_index(index)); |
446 | XA_BUG_ON(xa, xa_load(xa, max) != NULL); | 451 | XA_BUG_ON(xa, xa_load(xa, max) != NULL); |
447 | XA_BUG_ON(xa, xa_load(xa, min - 1) != NULL); | 452 | XA_BUG_ON(xa, xa_load(xa, min - 1) != NULL); |
448 | 453 | ||
449 | xas_lock(&xas); | 454 | xas_lock(&xas); |
450 | XA_BUG_ON(xa, xas_store(&xas, xa_mk_value(min)) != xa_mk_value(index)); | 455 | XA_BUG_ON(xa, xas_store(&xas, xa_mk_index(min)) != xa_mk_index(index)); |
451 | xas_unlock(&xas); | 456 | xas_unlock(&xas); |
452 | XA_BUG_ON(xa, xa_load(xa, min) != xa_mk_value(min)); | 457 | XA_BUG_ON(xa, xa_load(xa, min) != xa_mk_index(min)); |
453 | XA_BUG_ON(xa, xa_load(xa, max - 1) != xa_mk_value(min)); | 458 | XA_BUG_ON(xa, xa_load(xa, max - 1) != xa_mk_index(min)); |
454 | XA_BUG_ON(xa, xa_load(xa, max) != NULL); | 459 | XA_BUG_ON(xa, xa_load(xa, max) != NULL); |
455 | XA_BUG_ON(xa, xa_load(xa, min - 1) != NULL); | 460 | XA_BUG_ON(xa, xa_load(xa, min - 1) != NULL); |
456 | 461 | ||
@@ -523,15 +528,15 @@ static noinline void check_multi_store(struct xarray *xa) | |||
523 | 528 | ||
524 | for (i = 0; i < max_order; i++) { | 529 | for (i = 0; i < max_order; i++) { |
525 | for (j = 0; j < max_order; j++) { | 530 | for (j = 0; j < max_order; j++) { |
526 | xa_store_order(xa, 0, i, xa_mk_value(i), GFP_KERNEL); | 531 | xa_store_order(xa, 0, i, xa_mk_index(i), GFP_KERNEL); |
527 | xa_store_order(xa, 0, j, xa_mk_value(j), GFP_KERNEL); | 532 | xa_store_order(xa, 0, j, xa_mk_index(j), GFP_KERNEL); |
528 | 533 | ||
529 | for (k = 0; k < max_order; k++) { | 534 | for (k = 0; k < max_order; k++) { |
530 | void *entry = xa_load(xa, (1UL << k) - 1); | 535 | void *entry = xa_load(xa, (1UL << k) - 1); |
531 | if ((i < k) && (j < k)) | 536 | if ((i < k) && (j < k)) |
532 | XA_BUG_ON(xa, entry != NULL); | 537 | XA_BUG_ON(xa, entry != NULL); |
533 | else | 538 | else |
534 | XA_BUG_ON(xa, entry != xa_mk_value(j)); | 539 | XA_BUG_ON(xa, entry != xa_mk_index(j)); |
535 | } | 540 | } |
536 | 541 | ||
537 | xa_erase(xa, 0); | 542 | xa_erase(xa, 0); |
@@ -587,13 +592,13 @@ static noinline void check_xa_alloc(void) | |||
587 | xa_destroy(&xa0); | 592 | xa_destroy(&xa0); |
588 | 593 | ||
589 | id = 0xfffffffeU; | 594 | id = 0xfffffffeU; |
590 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, UINT_MAX, xa_mk_value(0), | 595 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, UINT_MAX, xa_mk_index(id), |
591 | GFP_KERNEL) != 0); | 596 | GFP_KERNEL) != 0); |
592 | XA_BUG_ON(&xa0, id != 0xfffffffeU); | 597 | XA_BUG_ON(&xa0, id != 0xfffffffeU); |
593 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, UINT_MAX, xa_mk_value(0), | 598 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, UINT_MAX, xa_mk_index(id), |
594 | GFP_KERNEL) != 0); | 599 | GFP_KERNEL) != 0); |
595 | XA_BUG_ON(&xa0, id != 0xffffffffU); | 600 | XA_BUG_ON(&xa0, id != 0xffffffffU); |
596 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, UINT_MAX, xa_mk_value(0), | 601 | XA_BUG_ON(&xa0, xa_alloc(&xa0, &id, UINT_MAX, xa_mk_index(id), |
597 | GFP_KERNEL) != -ENOSPC); | 602 | GFP_KERNEL) != -ENOSPC); |
598 | XA_BUG_ON(&xa0, id != 0xffffffffU); | 603 | XA_BUG_ON(&xa0, id != 0xffffffffU); |
599 | xa_destroy(&xa0); | 604 | xa_destroy(&xa0); |
@@ -610,11 +615,11 @@ retry: | |||
610 | xas_lock(&xas); | 615 | xas_lock(&xas); |
611 | xas_for_each_conflict(&xas, entry) { | 616 | xas_for_each_conflict(&xas, entry) { |
612 | XA_BUG_ON(xa, !xa_is_value(entry)); | 617 | XA_BUG_ON(xa, !xa_is_value(entry)); |
613 | XA_BUG_ON(xa, entry < xa_mk_value(start)); | 618 | XA_BUG_ON(xa, entry < xa_mk_index(start)); |
614 | XA_BUG_ON(xa, entry > xa_mk_value(start + (1UL << order) - 1)); | 619 | XA_BUG_ON(xa, entry > xa_mk_index(start + (1UL << order) - 1)); |
615 | count++; | 620 | count++; |
616 | } | 621 | } |
617 | xas_store(&xas, xa_mk_value(start)); | 622 | xas_store(&xas, xa_mk_index(start)); |
618 | xas_unlock(&xas); | 623 | xas_unlock(&xas); |
619 | if (xas_nomem(&xas, GFP_KERNEL)) { | 624 | if (xas_nomem(&xas, GFP_KERNEL)) { |
620 | count = 0; | 625 | count = 0; |
@@ -622,9 +627,9 @@ retry: | |||
622 | } | 627 | } |
623 | XA_BUG_ON(xa, xas_error(&xas)); | 628 | XA_BUG_ON(xa, xas_error(&xas)); |
624 | XA_BUG_ON(xa, count != present); | 629 | XA_BUG_ON(xa, count != present); |
625 | XA_BUG_ON(xa, xa_load(xa, start) != xa_mk_value(start)); | 630 | XA_BUG_ON(xa, xa_load(xa, start) != xa_mk_index(start)); |
626 | XA_BUG_ON(xa, xa_load(xa, start + (1UL << order) - 1) != | 631 | XA_BUG_ON(xa, xa_load(xa, start + (1UL << order) - 1) != |
627 | xa_mk_value(start)); | 632 | xa_mk_index(start)); |
628 | xa_erase_index(xa, start); | 633 | xa_erase_index(xa, start); |
629 | } | 634 | } |
630 | 635 | ||
@@ -703,7 +708,7 @@ static noinline void check_multi_find_2(struct xarray *xa) | |||
703 | for (j = 0; j < index; j++) { | 708 | for (j = 0; j < index; j++) { |
704 | XA_STATE(xas, xa, j + index); | 709 | XA_STATE(xas, xa, j + index); |
705 | xa_store_index(xa, index - 1, GFP_KERNEL); | 710 | xa_store_index(xa, index - 1, GFP_KERNEL); |
706 | xa_store_order(xa, index, i, xa_mk_value(index), | 711 | xa_store_order(xa, index, i, xa_mk_index(index), |
707 | GFP_KERNEL); | 712 | GFP_KERNEL); |
708 | rcu_read_lock(); | 713 | rcu_read_lock(); |
709 | xas_for_each(&xas, entry, ULONG_MAX) { | 714 | xas_for_each(&xas, entry, ULONG_MAX) { |
@@ -778,7 +783,7 @@ static noinline void check_find_2(struct xarray *xa) | |||
778 | j = 0; | 783 | j = 0; |
779 | index = 0; | 784 | index = 0; |
780 | xa_for_each(xa, entry, index, ULONG_MAX, XA_PRESENT) { | 785 | xa_for_each(xa, entry, index, ULONG_MAX, XA_PRESENT) { |
781 | XA_BUG_ON(xa, xa_mk_value(index) != entry); | 786 | XA_BUG_ON(xa, xa_mk_index(index) != entry); |
782 | XA_BUG_ON(xa, index != j++); | 787 | XA_BUG_ON(xa, index != j++); |
783 | } | 788 | } |
784 | } | 789 | } |
@@ -829,11 +834,11 @@ static noinline void check_find_entry(struct xarray *xa) | |||
829 | for (index = 0; index < (1UL << (order + 5)); | 834 | for (index = 0; index < (1UL << (order + 5)); |
830 | index += (1UL << order)) { | 835 | index += (1UL << order)) { |
831 | xa_store_order(xa, index, order, | 836 | xa_store_order(xa, index, order, |
832 | xa_mk_value(index), GFP_KERNEL); | 837 | xa_mk_index(index), GFP_KERNEL); |
833 | XA_BUG_ON(xa, xa_load(xa, index) != | 838 | XA_BUG_ON(xa, xa_load(xa, index) != |
834 | xa_mk_value(index)); | 839 | xa_mk_index(index)); |
835 | XA_BUG_ON(xa, xa_find_entry(xa, | 840 | XA_BUG_ON(xa, xa_find_entry(xa, |
836 | xa_mk_value(index)) != index); | 841 | xa_mk_index(index)) != index); |
837 | } | 842 | } |
838 | XA_BUG_ON(xa, xa_find_entry(xa, xa) != -1); | 843 | XA_BUG_ON(xa, xa_find_entry(xa, xa) != -1); |
839 | xa_destroy(xa); | 844 | xa_destroy(xa); |
@@ -844,7 +849,7 @@ static noinline void check_find_entry(struct xarray *xa) | |||
844 | XA_BUG_ON(xa, xa_find_entry(xa, xa) != -1); | 849 | XA_BUG_ON(xa, xa_find_entry(xa, xa) != -1); |
845 | xa_store_index(xa, ULONG_MAX, GFP_KERNEL); | 850 | xa_store_index(xa, ULONG_MAX, GFP_KERNEL); |
846 | XA_BUG_ON(xa, xa_find_entry(xa, xa) != -1); | 851 | XA_BUG_ON(xa, xa_find_entry(xa, xa) != -1); |
847 | XA_BUG_ON(xa, xa_find_entry(xa, xa_mk_value(LONG_MAX)) != -1); | 852 | XA_BUG_ON(xa, xa_find_entry(xa, xa_mk_index(ULONG_MAX)) != -1); |
848 | xa_erase_index(xa, ULONG_MAX); | 853 | xa_erase_index(xa, ULONG_MAX); |
849 | XA_BUG_ON(xa, !xa_empty(xa)); | 854 | XA_BUG_ON(xa, !xa_empty(xa)); |
850 | } | 855 | } |
@@ -864,7 +869,7 @@ static noinline void check_move_small(struct xarray *xa, unsigned long idx) | |||
864 | XA_BUG_ON(xa, xas.xa_node == XAS_RESTART); | 869 | XA_BUG_ON(xa, xas.xa_node == XAS_RESTART); |
865 | XA_BUG_ON(xa, xas.xa_index != i); | 870 | XA_BUG_ON(xa, xas.xa_index != i); |
866 | if (i == 0 || i == idx) | 871 | if (i == 0 || i == idx) |
867 | XA_BUG_ON(xa, entry != xa_mk_value(i)); | 872 | XA_BUG_ON(xa, entry != xa_mk_index(i)); |
868 | else | 873 | else |
869 | XA_BUG_ON(xa, entry != NULL); | 874 | XA_BUG_ON(xa, entry != NULL); |
870 | } | 875 | } |
@@ -878,7 +883,7 @@ static noinline void check_move_small(struct xarray *xa, unsigned long idx) | |||
878 | XA_BUG_ON(xa, xas.xa_node == XAS_RESTART); | 883 | XA_BUG_ON(xa, xas.xa_node == XAS_RESTART); |
879 | XA_BUG_ON(xa, xas.xa_index != i); | 884 | XA_BUG_ON(xa, xas.xa_index != i); |
880 | if (i == 0 || i == idx) | 885 | if (i == 0 || i == idx) |
881 | XA_BUG_ON(xa, entry != xa_mk_value(i)); | 886 | XA_BUG_ON(xa, entry != xa_mk_index(i)); |
882 | else | 887 | else |
883 | XA_BUG_ON(xa, entry != NULL); | 888 | XA_BUG_ON(xa, entry != NULL); |
884 | } while (i > 0); | 889 | } while (i > 0); |
@@ -909,7 +914,7 @@ static noinline void check_move(struct xarray *xa) | |||
909 | do { | 914 | do { |
910 | void *entry = xas_prev(&xas); | 915 | void *entry = xas_prev(&xas); |
911 | i--; | 916 | i--; |
912 | XA_BUG_ON(xa, entry != xa_mk_value(i)); | 917 | XA_BUG_ON(xa, entry != xa_mk_index(i)); |
913 | XA_BUG_ON(xa, i != xas.xa_index); | 918 | XA_BUG_ON(xa, i != xas.xa_index); |
914 | } while (i != 0); | 919 | } while (i != 0); |
915 | 920 | ||
@@ -918,7 +923,7 @@ static noinline void check_move(struct xarray *xa) | |||
918 | 923 | ||
919 | do { | 924 | do { |
920 | void *entry = xas_next(&xas); | 925 | void *entry = xas_next(&xas); |
921 | XA_BUG_ON(xa, entry != xa_mk_value(i)); | 926 | XA_BUG_ON(xa, entry != xa_mk_index(i)); |
922 | XA_BUG_ON(xa, i != xas.xa_index); | 927 | XA_BUG_ON(xa, i != xas.xa_index); |
923 | i++; | 928 | i++; |
924 | } while (i < (1 << 16)); | 929 | } while (i < (1 << 16)); |
@@ -934,7 +939,7 @@ static noinline void check_move(struct xarray *xa) | |||
934 | void *entry = xas_prev(&xas); | 939 | void *entry = xas_prev(&xas); |
935 | i--; | 940 | i--; |
936 | if ((i < (1 << 8)) || (i >= (1 << 15))) | 941 | if ((i < (1 << 8)) || (i >= (1 << 15))) |
937 | XA_BUG_ON(xa, entry != xa_mk_value(i)); | 942 | XA_BUG_ON(xa, entry != xa_mk_index(i)); |
938 | else | 943 | else |
939 | XA_BUG_ON(xa, entry != NULL); | 944 | XA_BUG_ON(xa, entry != NULL); |
940 | XA_BUG_ON(xa, i != xas.xa_index); | 945 | XA_BUG_ON(xa, i != xas.xa_index); |
@@ -946,7 +951,7 @@ static noinline void check_move(struct xarray *xa) | |||
946 | do { | 951 | do { |
947 | void *entry = xas_next(&xas); | 952 | void *entry = xas_next(&xas); |
948 | if ((i < (1 << 8)) || (i >= (1 << 15))) | 953 | if ((i < (1 << 8)) || (i >= (1 << 15))) |
949 | XA_BUG_ON(xa, entry != xa_mk_value(i)); | 954 | XA_BUG_ON(xa, entry != xa_mk_index(i)); |
950 | else | 955 | else |
951 | XA_BUG_ON(xa, entry != NULL); | 956 | XA_BUG_ON(xa, entry != NULL); |
952 | XA_BUG_ON(xa, i != xas.xa_index); | 957 | XA_BUG_ON(xa, i != xas.xa_index); |
@@ -976,7 +981,7 @@ static noinline void xa_store_many_order(struct xarray *xa, | |||
976 | if (xas_error(&xas)) | 981 | if (xas_error(&xas)) |
977 | goto unlock; | 982 | goto unlock; |
978 | for (i = 0; i < (1U << order); i++) { | 983 | for (i = 0; i < (1U << order); i++) { |
979 | XA_BUG_ON(xa, xas_store(&xas, xa_mk_value(index + i))); | 984 | XA_BUG_ON(xa, xas_store(&xas, xa_mk_index(index + i))); |
980 | xas_next(&xas); | 985 | xas_next(&xas); |
981 | } | 986 | } |
982 | unlock: | 987 | unlock: |
@@ -1031,9 +1036,9 @@ static noinline void check_create_range_4(struct xarray *xa, | |||
1031 | if (xas_error(&xas)) | 1036 | if (xas_error(&xas)) |
1032 | goto unlock; | 1037 | goto unlock; |
1033 | for (i = 0; i < (1UL << order); i++) { | 1038 | for (i = 0; i < (1UL << order); i++) { |
1034 | void *old = xas_store(&xas, xa_mk_value(base + i)); | 1039 | void *old = xas_store(&xas, xa_mk_index(base + i)); |
1035 | if (xas.xa_index == index) | 1040 | if (xas.xa_index == index) |
1036 | XA_BUG_ON(xa, old != xa_mk_value(base + i)); | 1041 | XA_BUG_ON(xa, old != xa_mk_index(base + i)); |
1037 | else | 1042 | else |
1038 | XA_BUG_ON(xa, old != NULL); | 1043 | XA_BUG_ON(xa, old != NULL); |
1039 | xas_next(&xas); | 1044 | xas_next(&xas); |
@@ -1085,10 +1090,10 @@ static noinline void __check_store_range(struct xarray *xa, unsigned long first, | |||
1085 | unsigned long last) | 1090 | unsigned long last) |
1086 | { | 1091 | { |
1087 | #ifdef CONFIG_XARRAY_MULTI | 1092 | #ifdef CONFIG_XARRAY_MULTI |
1088 | xa_store_range(xa, first, last, xa_mk_value(first), GFP_KERNEL); | 1093 | xa_store_range(xa, first, last, xa_mk_index(first), GFP_KERNEL); |
1089 | 1094 | ||
1090 | XA_BUG_ON(xa, xa_load(xa, first) != xa_mk_value(first)); | 1095 | XA_BUG_ON(xa, xa_load(xa, first) != xa_mk_index(first)); |
1091 | XA_BUG_ON(xa, xa_load(xa, last) != xa_mk_value(first)); | 1096 | XA_BUG_ON(xa, xa_load(xa, last) != xa_mk_index(first)); |
1092 | XA_BUG_ON(xa, xa_load(xa, first - 1) != NULL); | 1097 | XA_BUG_ON(xa, xa_load(xa, first - 1) != NULL); |
1093 | XA_BUG_ON(xa, xa_load(xa, last + 1) != NULL); | 1098 | XA_BUG_ON(xa, xa_load(xa, last + 1) != NULL); |
1094 | 1099 | ||
@@ -1195,7 +1200,7 @@ static noinline void check_account(struct xarray *xa) | |||
1195 | XA_BUG_ON(xa, xas.xa_node->nr_values != 0); | 1200 | XA_BUG_ON(xa, xas.xa_node->nr_values != 0); |
1196 | rcu_read_unlock(); | 1201 | rcu_read_unlock(); |
1197 | 1202 | ||
1198 | xa_store_order(xa, 1 << order, order, xa_mk_value(1 << order), | 1203 | xa_store_order(xa, 1 << order, order, xa_mk_index(1UL << order), |
1199 | GFP_KERNEL); | 1204 | GFP_KERNEL); |
1200 | XA_BUG_ON(xa, xas.xa_node->count != xas.xa_node->nr_values * 2); | 1205 | XA_BUG_ON(xa, xas.xa_node->count != xas.xa_node->nr_values * 2); |
1201 | 1206 | ||