|
Lines 423-442
cam_iosched_iops_init(struct iop_stats *ios)
Link Here
|
| 423 |
static int |
423 |
static int |
| 424 |
cam_iosched_iops_tick(struct iop_stats *ios) |
424 |
cam_iosched_iops_tick(struct iop_stats *ios) |
| 425 |
{ |
425 |
{ |
|
|
426 |
int new_ios; |
| 426 |
|
427 |
|
| 427 |
if ((ios->softc->total_ticks % ios->softc->quanta) == 0) |
428 |
new_ios = (int)((ios->current * (uint64_t)ios->softc->this_frac) >> 16); |
| 428 |
ios->l_value2 = 0; |
|
|
| 429 |
|
| 430 |
ios->l_value1 = (int)((ios->current * (uint64_t)ios->softc->this_frac) >> 16); |
| 431 |
/* |
429 |
/* |
| 432 |
* Allow at least one IO per tick until all |
430 |
* Allow at least one IO per tick until all |
| 433 |
* the IOs for this interval have been spent. |
431 |
* the IOs for this interval have been spent. |
| 434 |
*/ |
432 |
*/ |
| 435 |
if (ios->l_value1 <= 0 && ios->l_value2 < ios->current) { |
433 |
if (new_ios < 1 && ios->l_value2 < ios->current) { |
| 436 |
ios->l_value1 = 1; |
434 |
new_ios = 1; |
| 437 |
ios->l_value2++; |
435 |
ios->l_value2++; |
| 438 |
} |
436 |
} |
| 439 |
|
437 |
|
|
|
438 |
/* |
| 439 |
* If this a new accounting interval, discard any "unspent" ios |
| 440 |
* granted in the previous interval. Otherwise add the new ios to |
| 441 |
* the previously granted ones that haven't been spent yet. |
| 442 |
*/ |
| 443 |
if ((ios->softc->total_ticks % ios->softc->quanta) == 0) { |
| 444 |
ios->l_value1 = new_ios; |
| 445 |
ios->l_value2 = 1; |
| 446 |
} else { |
| 447 |
ios->l_value1 += new_ios; |
| 448 |
} |
| 449 |
|
| 440 |
return 0; |
450 |
return 0; |
| 441 |
} |
451 |
} |
| 442 |
|
452 |
|
| 443 |
- |
|
|