[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/2] qemu-img: add support for rate limit in qemu-img conv
From: |
Alberto Garcia |
Subject: |
Re: [PATCH v2 2/2] qemu-img: add support for rate limit in qemu-img convert |
Date: |
Tue, 20 Oct 2020 14:13:05 +0200 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
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 <berto@igalia.com>
Berto