On Tue 20 Oct 2020 01:39:06 PM CEST, Zhengui li wrote:

> +static void set_rate_limit(BlockBackend *blk, int64_t rate_limit)
> +{
> +    ThrottleConfig cfg;
> +
> +    throttle_config_init(&cfg);
> +    cfg.buckets[THROTTLE_BPS_WRITE].avg = rate_limit;
> +
> +    blk_io_limits_enable(blk, CONVERT_THROTTLE_GROUP);
> +    blk_set_io_limits(blk, &cfg);
> +}

You only use this code once so I don't know if it really deserves to
have a separate function, but it's ok I guess :)

> +        case 'r': {
> +            int64_t sval;
> +
> +            sval = cvtnum("rate limit", optarg);
> +            if (sval < 0) {
> +                goto fail_getopt;
> +            }
> +            rate_limit = sval;
> +        }   break;

As with the other patch I would get rid of 'sval' here.

With that changed,

Reviewed-by: Alberto Garcia <be...@igalia.com>

Berto

Reply via email to