View | Details | Raw Unified | Return to bug 221974
Collapse All | Expand All

(-)b/sys/cam/cam_iosched.c (-3 / +11 lines)
Lines 415-420 cam_iosched_iops_init(struct iop_stats *ios) Link Here
415
	ios->l_value1 = ios->current / ios->softc->quanta;
415
	ios->l_value1 = ios->current / ios->softc->quanta;
416
	if (ios->l_value1 <= 0)
416
	if (ios->l_value1 <= 0)
417
		ios->l_value1 = 1;
417
		ios->l_value1 = 1;
418
	ios->l_value2 = 0;
418
419
419
	return 0;
420
	return 0;
420
}
421
}
Lines 423-431 static int Link Here
423
cam_iosched_iops_tick(struct iop_stats *ios)
424
cam_iosched_iops_tick(struct iop_stats *ios)
424
{
425
{
425
426
427
	if ((ios->softc->total_ticks % ios->softc->quanta) == 0)
428
		ios->l_value2 = 0;
429
426
	ios->l_value1 = (int)((ios->current * (uint64_t)ios->softc->this_frac) >> 16);
430
	ios->l_value1 = (int)((ios->current * (uint64_t)ios->softc->this_frac) >> 16);
427
	if (ios->l_value1 <= 0)
431
	/*
432
	 * Allow at least one IO per tick until all
433
	 * the IOs for this interval have been spent.
434
	 */
435
	if (ios->l_value1 <= 0 && ios->l_value2 < ios->current) {
428
		ios->l_value1 = 1;
436
		ios->l_value1 = 1;
437
		ios->l_value2++;
438
	}
429
439
430
	return 0;
440
	return 0;
431
}
441
}
432
- 
433
discarding 'unspent' ios
442
discarding 'unspent' ios
434
--
435
sys/cam/cam_iosched.c | 22 ++++++++++++++++------
443
sys/cam/cam_iosched.c | 22 ++++++++++++++++------
436
1 file changed, 16 insertions(+), 6 deletions(-)
444
1 file changed, 16 insertions(+), 6 deletions(-)
(-)b/sys/cam/cam_iosched.c (-7 / +16 lines)
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
- 

Return to bug 221974