| .. | .. |
|---|
| 214 | 214 | } |
|---|
| 215 | 215 | |
|---|
| 216 | 216 | // printf("\ncopying tags...\n"); |
|---|
| 217 | | - tagged = tag_tagged_items(&tree, NULL, start, end, ITEMS, 0, 1); |
|---|
| 217 | + tagged = tag_tagged_items(&tree, start, end, ITEMS, XA_MARK_0, XA_MARK_1); |
|---|
| 218 | 218 | |
|---|
| 219 | 219 | // printf("checking copied tags\n"); |
|---|
| 220 | 220 | assert(tagged == count); |
|---|
| .. | .. |
|---|
| 223 | 223 | /* Copy tags in several rounds */ |
|---|
| 224 | 224 | // printf("\ncopying tags...\n"); |
|---|
| 225 | 225 | tmp = rand() % (count / 10 + 2); |
|---|
| 226 | | - tagged = tag_tagged_items(&tree, NULL, start, end, tmp, 0, 2); |
|---|
| 226 | + tagged = tag_tagged_items(&tree, start, end, tmp, XA_MARK_0, XA_MARK_2); |
|---|
| 227 | 227 | assert(tagged == count); |
|---|
| 228 | 228 | |
|---|
| 229 | 229 | // printf("%lu %lu %lu\n", tagged, tmp, count); |
|---|
| .. | .. |
|---|
| 236 | 236 | item_kill_tree(&tree); |
|---|
| 237 | 237 | } |
|---|
| 238 | 238 | |
|---|
| 239 | | -static void __locate_check(struct radix_tree_root *tree, unsigned long index, |
|---|
| 240 | | - unsigned order) |
|---|
| 241 | | -{ |
|---|
| 242 | | - struct item *item; |
|---|
| 243 | | - unsigned long index2; |
|---|
| 244 | | - |
|---|
| 245 | | - item_insert_order(tree, index, order); |
|---|
| 246 | | - item = item_lookup(tree, index); |
|---|
| 247 | | - index2 = find_item(tree, item); |
|---|
| 248 | | - if (index != index2) { |
|---|
| 249 | | - printv(2, "index %ld order %d inserted; found %ld\n", |
|---|
| 250 | | - index, order, index2); |
|---|
| 251 | | - abort(); |
|---|
| 252 | | - } |
|---|
| 253 | | -} |
|---|
| 254 | | - |
|---|
| 255 | | -static void __order_0_locate_check(void) |
|---|
| 256 | | -{ |
|---|
| 257 | | - RADIX_TREE(tree, GFP_KERNEL); |
|---|
| 258 | | - int i; |
|---|
| 259 | | - |
|---|
| 260 | | - for (i = 0; i < 50; i++) |
|---|
| 261 | | - __locate_check(&tree, rand() % INT_MAX, 0); |
|---|
| 262 | | - |
|---|
| 263 | | - item_kill_tree(&tree); |
|---|
| 264 | | -} |
|---|
| 265 | | - |
|---|
| 266 | | -static void locate_check(void) |
|---|
| 267 | | -{ |
|---|
| 268 | | - RADIX_TREE(tree, GFP_KERNEL); |
|---|
| 269 | | - unsigned order; |
|---|
| 270 | | - unsigned long offset, index; |
|---|
| 271 | | - |
|---|
| 272 | | - __order_0_locate_check(); |
|---|
| 273 | | - |
|---|
| 274 | | - for (order = 0; order < 20; order++) { |
|---|
| 275 | | - for (offset = 0; offset < (1 << (order + 3)); |
|---|
| 276 | | - offset += (1UL << order)) { |
|---|
| 277 | | - for (index = 0; index < (1UL << (order + 5)); |
|---|
| 278 | | - index += (1UL << order)) { |
|---|
| 279 | | - __locate_check(&tree, index + offset, order); |
|---|
| 280 | | - } |
|---|
| 281 | | - if (find_item(&tree, &tree) != -1) |
|---|
| 282 | | - abort(); |
|---|
| 283 | | - |
|---|
| 284 | | - item_kill_tree(&tree); |
|---|
| 285 | | - } |
|---|
| 286 | | - } |
|---|
| 287 | | - |
|---|
| 288 | | - if (find_item(&tree, &tree) != -1) |
|---|
| 289 | | - abort(); |
|---|
| 290 | | - __locate_check(&tree, -1, 0); |
|---|
| 291 | | - if (find_item(&tree, &tree) != -1) |
|---|
| 292 | | - abort(); |
|---|
| 293 | | - item_kill_tree(&tree); |
|---|
| 294 | | -} |
|---|
| 295 | | - |
|---|
| 296 | 239 | static void single_thread_tests(bool long_run) |
|---|
| 297 | 240 | { |
|---|
| 298 | 241 | int i; |
|---|
| .. | .. |
|---|
| 302 | 245 | multiorder_checks(); |
|---|
| 303 | 246 | rcu_barrier(); |
|---|
| 304 | 247 | printv(2, "after multiorder_check: %d allocated, preempt %d\n", |
|---|
| 305 | | - nr_allocated, preempt_count); |
|---|
| 306 | | - locate_check(); |
|---|
| 307 | | - rcu_barrier(); |
|---|
| 308 | | - printv(2, "after locate_check: %d allocated, preempt %d\n", |
|---|
| 309 | 248 | nr_allocated, preempt_count); |
|---|
| 310 | 249 | tag_check(); |
|---|
| 311 | 250 | rcu_barrier(); |
|---|
| .. | .. |
|---|
| 365 | 304 | rcu_register_thread(); |
|---|
| 366 | 305 | radix_tree_init(); |
|---|
| 367 | 306 | |
|---|
| 307 | + xarray_tests(); |
|---|
| 368 | 308 | regression1_test(); |
|---|
| 369 | 309 | regression2_test(); |
|---|
| 370 | 310 | regression3_test(); |
|---|
| 311 | + regression4_test(); |
|---|
| 371 | 312 | iteration_test(0, 10 + 90 * long_run); |
|---|
| 372 | 313 | iteration_test(7, 10 + 90 * long_run); |
|---|
| 314 | + iteration_test2(10 + 90 * long_run); |
|---|
| 373 | 315 | single_thread_tests(long_run); |
|---|
| 374 | 316 | |
|---|
| 375 | 317 | /* Free any remaining preallocated nodes */ |
|---|