@@ -1418,7 +1418,7 @@ static noinline void check_pause(struct xarray *xa)
1418
1418
{
1419
1419
XA_STATE (xas , xa , 0 );
1420
1420
void * entry ;
1421
- unsigned int order ;
1421
+ int order ;
1422
1422
unsigned long index = 1 ;
1423
1423
unsigned int count = 0 ;
1424
1424
@@ -1450,7 +1450,7 @@ static noinline void check_pause(struct xarray *xa)
1450
1450
xa_destroy (xa );
1451
1451
1452
1452
index = 0 ;
1453
- for (order = XA_CHUNK_SHIFT ; order > 0 ; order -- ) {
1453
+ for (order = order_limit - 1 ; order >= 0 ; order -- ) {
1454
1454
XA_BUG_ON (xa , xa_store_order (xa , index , order ,
1455
1455
xa_mk_index (index ), GFP_KERNEL ));
1456
1456
index += 1UL << order ;
@@ -1462,24 +1462,25 @@ static noinline void check_pause(struct xarray *xa)
1462
1462
rcu_read_lock ();
1463
1463
xas_for_each (& xas , entry , ULONG_MAX ) {
1464
1464
XA_BUG_ON (xa , entry != xa_mk_index (index ));
1465
- index += 1UL << (XA_CHUNK_SHIFT - count );
1465
+ index += 1UL << (order_limit - count - 1 );
1466
1466
count ++ ;
1467
1467
}
1468
1468
rcu_read_unlock ();
1469
- XA_BUG_ON (xa , count != XA_CHUNK_SHIFT );
1469
+ XA_BUG_ON (xa , count != order_limit );
1470
1470
1471
1471
index = 0 ;
1472
1472
count = 0 ;
1473
- xas_set (& xas , XA_CHUNK_SIZE / 2 + 1 );
1473
+ /* test unaligned index */
1474
+ xas_set (& xas , 1 % (1UL << (order_limit - 1 )));
1474
1475
rcu_read_lock ();
1475
1476
xas_for_each (& xas , entry , ULONG_MAX ) {
1476
1477
XA_BUG_ON (xa , entry != xa_mk_index (index ));
1477
- index += 1UL << (XA_CHUNK_SHIFT - count );
1478
+ index += 1UL << (order_limit - count - 1 );
1478
1479
count ++ ;
1479
1480
xas_pause (& xas );
1480
1481
}
1481
1482
rcu_read_unlock ();
1482
- XA_BUG_ON (xa , count != XA_CHUNK_SHIFT );
1483
+ XA_BUG_ON (xa , count != order_limit );
1483
1484
1484
1485
xa_destroy (xa );
1485
1486
0 commit comments