Lines Matching full:cfg
73 throttle_leak_bucket(&ts->cfg.buckets[i], delta_ns); in throttle_do_leak()
159 wait = throttle_compute_wait(&ts->cfg.buckets[index]); in throttle_compute_wait_for()
216 * @cfg: the config to initialize
218 void throttle_config_init(ThrottleConfig *cfg) in throttle_config_init() argument
221 memset(cfg, 0, sizeof(*cfg)); in throttle_config_init()
223 cfg->buckets[i].burst_length = 1; in throttle_config_init()
231 throttle_config_init(&ts->cfg); in throttle_init()
295 * @cfg: the throttling configuration to inspect
298 bool throttle_enabled(ThrottleConfig *cfg) in throttle_enabled() argument
303 if (cfg->buckets[i].avg > 0) { in throttle_enabled()
312 * @cfg: the throttling configuration to inspect
316 bool throttle_is_valid(ThrottleConfig *cfg, Error **errp) in throttle_is_valid() argument
322 bps_flag = cfg->buckets[THROTTLE_BPS_TOTAL].avg && in throttle_is_valid()
323 (cfg->buckets[THROTTLE_BPS_READ].avg || in throttle_is_valid()
324 cfg->buckets[THROTTLE_BPS_WRITE].avg); in throttle_is_valid()
326 ops_flag = cfg->buckets[THROTTLE_OPS_TOTAL].avg && in throttle_is_valid()
327 (cfg->buckets[THROTTLE_OPS_READ].avg || in throttle_is_valid()
328 cfg->buckets[THROTTLE_OPS_WRITE].avg); in throttle_is_valid()
330 bps_max_flag = cfg->buckets[THROTTLE_BPS_TOTAL].max && in throttle_is_valid()
331 (cfg->buckets[THROTTLE_BPS_READ].max || in throttle_is_valid()
332 cfg->buckets[THROTTLE_BPS_WRITE].max); in throttle_is_valid()
334 ops_max_flag = cfg->buckets[THROTTLE_OPS_TOTAL].max && in throttle_is_valid()
335 (cfg->buckets[THROTTLE_OPS_READ].max || in throttle_is_valid()
336 cfg->buckets[THROTTLE_OPS_WRITE].max); in throttle_is_valid()
344 if (cfg->op_size && in throttle_is_valid()
345 !cfg->buckets[THROTTLE_OPS_TOTAL].avg && in throttle_is_valid()
346 !cfg->buckets[THROTTLE_OPS_READ].avg && in throttle_is_valid()
347 !cfg->buckets[THROTTLE_OPS_WRITE].avg) { in throttle_is_valid()
353 LeakyBucket *bkt = &cfg->buckets[i]; in throttle_is_valid()
394 * @cfg: the config to set
398 ThrottleConfig *cfg) in throttle_config() argument
402 ts->cfg = *cfg; in throttle_config()
406 ts->cfg.buckets[i].level = 0; in throttle_config()
407 ts->cfg.buckets[i].burst_level = 0; in throttle_config()
416 * @cfg: the config to write
418 void throttle_get_config(ThrottleState *ts, ThrottleConfig *cfg) in throttle_get_config() argument
420 *cfg = ts->cfg; in throttle_get_config()
485 /* if cfg.op_size is defined and smaller than size we compute unit count */ in throttle_account()
486 if (ts->cfg.op_size && size > ts->cfg.op_size) { in throttle_account()
487 units = (double) size / ts->cfg.op_size; in throttle_account()
493 bkt = &ts->cfg.buckets[bucket_types_size[direction][i]]; in throttle_account()
499 bkt = &ts->cfg.buckets[bucket_types_units[direction][i]]; in throttle_account()
510 * @cfg: the ThrottleConfig to edit
513 void throttle_limits_to_config(ThrottleLimits *arg, ThrottleConfig *cfg, in throttle_limits_to_config() argument
517 cfg->buckets[THROTTLE_BPS_TOTAL].avg = arg->bps_total; in throttle_limits_to_config()
520 cfg->buckets[THROTTLE_BPS_READ].avg = arg->bps_read; in throttle_limits_to_config()
523 cfg->buckets[THROTTLE_BPS_WRITE].avg = arg->bps_write; in throttle_limits_to_config()
527 cfg->buckets[THROTTLE_OPS_TOTAL].avg = arg->iops_total; in throttle_limits_to_config()
530 cfg->buckets[THROTTLE_OPS_READ].avg = arg->iops_read; in throttle_limits_to_config()
533 cfg->buckets[THROTTLE_OPS_WRITE].avg = arg->iops_write; in throttle_limits_to_config()
537 cfg->buckets[THROTTLE_BPS_TOTAL].max = arg->bps_total_max; in throttle_limits_to_config()
540 cfg->buckets[THROTTLE_BPS_READ].max = arg->bps_read_max; in throttle_limits_to_config()
543 cfg->buckets[THROTTLE_BPS_WRITE].max = arg->bps_write_max; in throttle_limits_to_config()
546 cfg->buckets[THROTTLE_OPS_TOTAL].max = arg->iops_total_max; in throttle_limits_to_config()
549 cfg->buckets[THROTTLE_OPS_READ].max = arg->iops_read_max; in throttle_limits_to_config()
552 cfg->buckets[THROTTLE_OPS_WRITE].max = arg->iops_write_max; in throttle_limits_to_config()
561 cfg->buckets[THROTTLE_BPS_TOTAL].burst_length = arg->bps_total_max_length; in throttle_limits_to_config()
569 cfg->buckets[THROTTLE_BPS_READ].burst_length = arg->bps_read_max_length; in throttle_limits_to_config()
577 cfg->buckets[THROTTLE_BPS_WRITE].burst_length = arg->bps_write_max_length; in throttle_limits_to_config()
585 cfg->buckets[THROTTLE_OPS_TOTAL].burst_length = arg->iops_total_max_length; in throttle_limits_to_config()
593 cfg->buckets[THROTTLE_OPS_READ].burst_length = arg->iops_read_max_length; in throttle_limits_to_config()
601 cfg->buckets[THROTTLE_OPS_WRITE].burst_length = arg->iops_write_max_length; in throttle_limits_to_config()
605 cfg->op_size = arg->iops_size; in throttle_limits_to_config()
608 throttle_is_valid(cfg, errp); in throttle_limits_to_config()
613 * @cfg: the ThrottleConfig to read from
616 void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var) in throttle_config_to_limits() argument
618 var->bps_total = cfg->buckets[THROTTLE_BPS_TOTAL].avg; in throttle_config_to_limits()
619 var->bps_read = cfg->buckets[THROTTLE_BPS_READ].avg; in throttle_config_to_limits()
620 var->bps_write = cfg->buckets[THROTTLE_BPS_WRITE].avg; in throttle_config_to_limits()
621 var->iops_total = cfg->buckets[THROTTLE_OPS_TOTAL].avg; in throttle_config_to_limits()
622 var->iops_read = cfg->buckets[THROTTLE_OPS_READ].avg; in throttle_config_to_limits()
623 var->iops_write = cfg->buckets[THROTTLE_OPS_WRITE].avg; in throttle_config_to_limits()
624 var->bps_total_max = cfg->buckets[THROTTLE_BPS_TOTAL].max; in throttle_config_to_limits()
625 var->bps_read_max = cfg->buckets[THROTTLE_BPS_READ].max; in throttle_config_to_limits()
626 var->bps_write_max = cfg->buckets[THROTTLE_BPS_WRITE].max; in throttle_config_to_limits()
627 var->iops_total_max = cfg->buckets[THROTTLE_OPS_TOTAL].max; in throttle_config_to_limits()
628 var->iops_read_max = cfg->buckets[THROTTLE_OPS_READ].max; in throttle_config_to_limits()
629 var->iops_write_max = cfg->buckets[THROTTLE_OPS_WRITE].max; in throttle_config_to_limits()
630 var->bps_total_max_length = cfg->buckets[THROTTLE_BPS_TOTAL].burst_length; in throttle_config_to_limits()
631 var->bps_read_max_length = cfg->buckets[THROTTLE_BPS_READ].burst_length; in throttle_config_to_limits()
632 var->bps_write_max_length = cfg->buckets[THROTTLE_BPS_WRITE].burst_length; in throttle_config_to_limits()
633 var->iops_total_max_length = cfg->buckets[THROTTLE_OPS_TOTAL].burst_length; in throttle_config_to_limits()
634 var->iops_read_max_length = cfg->buckets[THROTTLE_OPS_READ].burst_length; in throttle_config_to_limits()
635 var->iops_write_max_length = cfg->buckets[THROTTLE_OPS_WRITE].burst_length; in throttle_config_to_limits()
636 var->iops_size = cfg->op_size; in throttle_config_to_limits()