@@ -364,7 +364,6 @@ void ida_check_random(void)
364
364
{
365
365
DEFINE_IDA (ida );
366
366
DECLARE_BITMAP (bitmap , 2048 );
367
- int id , err ;
368
367
unsigned int i ;
369
368
time_t s = time (NULL );
370
369
@@ -375,15 +374,11 @@ void ida_check_random(void)
375
374
int bit = i & 2047 ;
376
375
if (test_bit (bit , bitmap )) {
377
376
__clear_bit (bit , bitmap );
378
- ida_remove (& ida , bit );
377
+ ida_free (& ida , bit );
379
378
} else {
380
379
__set_bit (bit , bitmap );
381
- do {
382
- ida_pre_get (& ida , GFP_KERNEL );
383
- err = ida_get_new_above (& ida , bit , & id );
384
- } while (err == - EAGAIN );
385
- assert (!err );
386
- assert (id == bit );
380
+ IDA_BUG_ON (& ida , ida_alloc_min (& ida , bit , GFP_KERNEL )
381
+ != bit );
387
382
}
388
383
}
389
384
ida_destroy (& ida );
@@ -411,66 +406,9 @@ void ida_simple_get_remove_test(void)
411
406
412
407
void user_ida_checks (void )
413
408
{
414
- DEFINE_IDA (ida );
415
- int id ;
416
- unsigned long i ;
417
-
418
409
radix_tree_cpu_dead (1 );
419
- ida_check_nomem ();
420
-
421
- for (i = 0 ; i < 10000 ; i ++ ) {
422
- assert (ida_pre_get (& ida , GFP_KERNEL ));
423
- assert (!ida_get_new (& ida , & id ));
424
- assert (id == i );
425
- }
426
-
427
- ida_remove (& ida , 20 );
428
- ida_remove (& ida , 21 );
429
- for (i = 0 ; i < 3 ; i ++ ) {
430
- assert (ida_pre_get (& ida , GFP_KERNEL ));
431
- assert (!ida_get_new (& ida , & id ));
432
- if (i == 2 )
433
- assert (id == 10000 );
434
- }
435
-
436
- for (i = 0 ; i < 5000 ; i ++ )
437
- ida_remove (& ida , i );
438
-
439
- assert (ida_pre_get (& ida , GFP_KERNEL ));
440
- assert (!ida_get_new_above (& ida , 5000 , & id ));
441
- assert (id == 10001 );
442
-
443
- ida_destroy (& ida );
444
-
445
- assert (ida_is_empty (& ida ));
446
-
447
- assert (ida_pre_get (& ida , GFP_KERNEL ));
448
- assert (!ida_get_new_above (& ida , 1 , & id ));
449
- assert (id == 1 );
450
-
451
- ida_remove (& ida , id );
452
- assert (ida_is_empty (& ida ));
453
- ida_destroy (& ida );
454
- assert (ida_is_empty (& ida ));
455
-
456
- assert (ida_pre_get (& ida , GFP_KERNEL ));
457
- assert (!ida_get_new_above (& ida , 1 , & id ));
458
- ida_destroy (& ida );
459
- assert (ida_is_empty (& ida ));
460
-
461
- assert (ida_pre_get (& ida , GFP_KERNEL ));
462
- assert (!ida_get_new_above (& ida , 1 , & id ));
463
- assert (id == 1 );
464
- assert (ida_pre_get (& ida , GFP_KERNEL ));
465
- assert (!ida_get_new_above (& ida , 1025 , & id ));
466
- assert (id == 1025 );
467
- assert (ida_pre_get (& ida , GFP_KERNEL ));
468
- assert (!ida_get_new_above (& ida , 10000 , & id ));
469
- assert (id == 10000 );
470
- ida_remove (& ida , 1025 );
471
- ida_destroy (& ida );
472
- assert (ida_is_empty (& ida ));
473
410
411
+ ida_check_nomem ();
474
412
ida_check_conv_user ();
475
413
ida_check_random ();
476
414
ida_simple_get_remove_test ();
0 commit comments