@@ -339,59 +339,23 @@ void ida_check_nomem(void)
339
339
/*
340
340
* Check handling of conversions between exceptional entries and full bitmaps.
341
341
*/
342
- void ida_check_conv (void )
342
+ void ida_check_conv_user (void )
343
343
{
344
344
DEFINE_IDA (ida );
345
- int id ;
346
345
unsigned long i ;
347
346
348
- for (i = 0 ; i < IDA_BITMAP_BITS * 2 ; i += IDA_BITMAP_BITS ) {
349
- assert (ida_pre_get (& ida , GFP_KERNEL ));
350
- assert (!ida_get_new_above (& ida , i + 1 , & id ));
351
- assert (id == i + 1 );
352
- assert (!ida_get_new_above (& ida , i + BITS_PER_LONG , & id ));
353
- assert (id == i + BITS_PER_LONG );
354
- ida_remove (& ida , i + 1 );
355
- ida_remove (& ida , i + BITS_PER_LONG );
356
- assert (ida_is_empty (& ida ));
357
- }
358
-
359
- assert (ida_pre_get (& ida , GFP_KERNEL ));
360
-
361
- for (i = 0 ; i < IDA_BITMAP_BITS * 2 ; i ++ ) {
362
- assert (ida_pre_get (& ida , GFP_KERNEL ));
363
- assert (!ida_get_new (& ida , & id ));
364
- assert (id == i );
365
- }
366
-
367
- for (i = IDA_BITMAP_BITS * 2 ; i > 0 ; i -- ) {
368
- ida_remove (& ida , i - 1 );
369
- }
370
- assert (ida_is_empty (& ida ));
371
-
372
- for (i = 0 ; i < IDA_BITMAP_BITS + BITS_PER_LONG - 4 ; i ++ ) {
373
- assert (ida_pre_get (& ida , GFP_KERNEL ));
374
- assert (!ida_get_new (& ida , & id ));
375
- assert (id == i );
376
- }
377
-
378
- for (i = IDA_BITMAP_BITS + BITS_PER_LONG - 4 ; i > 0 ; i -- ) {
379
- ida_remove (& ida , i - 1 );
380
- }
381
- assert (ida_is_empty (& ida ));
382
-
383
347
radix_tree_cpu_dead (1 );
384
348
for (i = 0 ; i < 1000000 ; i ++ ) {
385
- int err = ida_get_new (& ida , & id );
386
- if (err == - EAGAIN ) {
387
- assert ( (i % IDA_BITMAP_BITS ) == ( BITS_PER_LONG - 2 ));
388
- assert ( ida_pre_get ( & ida , GFP_KERNEL ) );
389
- err = ida_get_new (& ida , & id );
349
+ int id = ida_alloc (& ida , GFP_NOWAIT );
350
+ if (id == - ENOMEM ) {
351
+ IDA_BUG_ON ( & ida , (i % IDA_BITMAP_BITS ) !=
352
+ BITS_PER_LONG - 2 );
353
+ id = ida_alloc (& ida , GFP_KERNEL );
390
354
} else {
391
- assert ((i % IDA_BITMAP_BITS ) != (BITS_PER_LONG - 2 ));
355
+ IDA_BUG_ON (& ida , (i % IDA_BITMAP_BITS ) ==
356
+ BITS_PER_LONG - 2 );
392
357
}
393
- assert (!err );
394
- assert (id == i );
358
+ IDA_BUG_ON (& ida , id != i );
395
359
}
396
360
ida_destroy (& ida );
397
361
}
@@ -507,7 +471,7 @@ void user_ida_checks(void)
507
471
ida_destroy (& ida );
508
472
assert (ida_is_empty (& ida ));
509
473
510
- ida_check_conv ();
474
+ ida_check_conv_user ();
511
475
ida_check_random ();
512
476
ida_simple_get_remove_test ();
513
477
0 commit comments