diff options
Diffstat (limited to 'lib/test_xarray.c')
-rw-r--r-- | lib/test_xarray.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/test_xarray.c b/lib/test_xarray.c index 0f06a93b4d0e..aa47754150ce 100644 --- a/lib/test_xarray.c +++ b/lib/test_xarray.c | |||
@@ -1039,6 +1039,39 @@ static noinline void check_create_range(struct xarray *xa) | |||
1039 | check_create_range_3(); | 1039 | check_create_range_3(); |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | static noinline void __check_store_range(struct xarray *xa, unsigned long first, | ||
1043 | unsigned long last) | ||
1044 | { | ||
1045 | #ifdef CONFIG_XARRAY_MULTI | ||
1046 | xa_store_range(xa, first, last, xa_mk_value(first), GFP_KERNEL); | ||
1047 | |||
1048 | XA_BUG_ON(xa, xa_load(xa, first) != xa_mk_value(first)); | ||
1049 | XA_BUG_ON(xa, xa_load(xa, last) != xa_mk_value(first)); | ||
1050 | XA_BUG_ON(xa, xa_load(xa, first - 1) != NULL); | ||
1051 | XA_BUG_ON(xa, xa_load(xa, last + 1) != NULL); | ||
1052 | |||
1053 | xa_store_range(xa, first, last, NULL, GFP_KERNEL); | ||
1054 | #endif | ||
1055 | |||
1056 | XA_BUG_ON(xa, !xa_empty(xa)); | ||
1057 | } | ||
1058 | |||
1059 | static noinline void check_store_range(struct xarray *xa) | ||
1060 | { | ||
1061 | unsigned long i, j; | ||
1062 | |||
1063 | for (i = 0; i < 128; i++) { | ||
1064 | for (j = i; j < 128; j++) { | ||
1065 | __check_store_range(xa, i, j); | ||
1066 | __check_store_range(xa, 128 + i, 128 + j); | ||
1067 | __check_store_range(xa, 4095 + i, 4095 + j); | ||
1068 | __check_store_range(xa, 4096 + i, 4096 + j); | ||
1069 | __check_store_range(xa, 123456 + i, 123456 + j); | ||
1070 | __check_store_range(xa, UINT_MAX + i, UINT_MAX + j); | ||
1071 | } | ||
1072 | } | ||
1073 | } | ||
1074 | |||
1042 | static LIST_HEAD(shadow_nodes); | 1075 | static LIST_HEAD(shadow_nodes); |
1043 | 1076 | ||
1044 | static void test_update_node(struct xa_node *node) | 1077 | static void test_update_node(struct xa_node *node) |
@@ -1184,6 +1217,7 @@ static int xarray_checks(void) | |||
1184 | check_destroy(&array); | 1217 | check_destroy(&array); |
1185 | check_move(&array); | 1218 | check_move(&array); |
1186 | check_create_range(&array); | 1219 | check_create_range(&array); |
1220 | check_store_range(&array); | ||
1187 | check_store_iter(&array); | 1221 | check_store_iter(&array); |
1188 | 1222 | ||
1189 | check_workingset(&array, 0); | 1223 | check_workingset(&array, 0); |