All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Pradeep Jagadeesh <pradeepkiruvale@gmail.com>
Cc: eric blake <eblake@redhat.com>, greg kurz <groug@kaod.org>,
	Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>,
	alberto garcia <berto@igalia.com>,
	jani kokkonen <jani.kokkonen@huawei.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v6 4/6] hmp: create a throttle initialization function
Date: Fri, 30 Jun 2017 10:14:59 +0100	[thread overview]
Message-ID: <20170630091458.GA2132@work-vm> (raw)
In-Reply-To: <1498749056-38565-5-git-send-email-pradeep.jagadeesh@huawei.com>

* Pradeep Jagadeesh (pradeepkiruvale@gmail.com) wrote:
> This patch creates a throttle initialization function to maximize the
> code reusability. The same code is also used by fsdev.
> 
> Signed-off-by: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>

Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  hmp.c | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/hmp.c b/hmp.c
> index 8c72c58..220d301 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1749,20 +1749,29 @@ void hmp_change(Monitor *mon, const QDict *qdict)
>      hmp_handle_error(mon, &err);
>  }
>  
> +static void hmp_initialize_io_throttle(IOThrottle *iot, const QDict *qdict)
> +{
> +    iot->has_id = true;
> +    iot->id = (char *) qdict_get_str(qdict, "id");
> +    iot->bps = qdict_get_int(qdict, "bps");
> +    iot->bps_rd = qdict_get_int(qdict, "bps_rd");
> +    iot->bps_wr = qdict_get_int(qdict, "bps_wr");
> +    iot->iops = qdict_get_int(qdict, "iops");
> +    iot->iops_rd = qdict_get_int(qdict, "iops_rd");
> +    iot->iops_wr = qdict_get_int(qdict, "iops_wr");
> +}
> +
>  void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
>  {
>      Error *err = NULL;
> +    IOThrottle *iothrottle;
>      BlockIOThrottle throttle = {
>          .has_device = true,
>          .device = (char *) qdict_get_str(qdict, "device"),
> -        .bps = qdict_get_int(qdict, "bps"),
> -        .bps_rd = qdict_get_int(qdict, "bps_rd"),
> -        .bps_wr = qdict_get_int(qdict, "bps_wr"),
> -        .iops = qdict_get_int(qdict, "iops"),
> -        .iops_rd = qdict_get_int(qdict, "iops_rd"),
> -        .iops_wr = qdict_get_int(qdict, "iops_wr"),
>      };
>  
> +    iothrottle = qapi_BlockIOThrottle_base(&throttle);
> +    hmp_initialize_io_throttle(iothrottle, qdict);
>      qmp_block_set_io_throttle(&throttle, &err);
>      hmp_handle_error(mon, &err);
>  }
> -- 
> 1.8.3.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2017-06-30  9:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 15:10 [Qemu-devel] [PATCH v6 0/6] fsdev: qmp interface for io throttling Pradeep Jagadeesh
2017-06-29 15:10 ` [Qemu-devel] [PATCH v6 1/6] throttle: factor out duplicate code Pradeep Jagadeesh
2017-06-29 15:10 ` [Qemu-devel] [PATCH v6 2/6] qmp: Create IOThrottle structure Pradeep Jagadeesh
2017-06-30 13:29   ` Alberto Garcia
2017-06-29 15:10 ` [Qemu-devel] [PATCH 3/6] throttle: move out function to reuse the code Pradeep Jagadeesh
2017-06-30 13:34   ` Alberto Garcia
2017-06-29 15:10 ` [Qemu-devel] [PATCH v6 4/6] hmp: create a throttle initialization function Pradeep Jagadeesh
2017-06-30  9:14   ` Dr. David Alan Gilbert [this message]
2017-06-29 15:10 ` [Qemu-devel] [PATCH v6 5/6] fsdev: hmp interface for throttling Pradeep Jagadeesh
2017-06-30  9:33   ` Dr. David Alan Gilbert
2017-07-03 13:58     ` Pradeep Jagadeesh
2017-06-29 15:10 ` [Qemu-devel] [PATCH v6 6/6] fsdev: QMP " Pradeep Jagadeesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170630091458.GA2132@work-vm \
    --to=dgilbert@redhat.com \
    --cc=berto@igalia.com \
    --cc=eblake@redhat.com \
    --cc=groug@kaod.org \
    --cc=jani.kokkonen@huawei.com \
    --cc=pradeep.jagadeesh@huawei.com \
    --cc=pradeepkiruvale@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.