From: Pradeep Jagadeesh <pradeepkiruvale@gmail.com>
To: eric blake <eblake@redhat.com>, greg kurz <groug@kaod.org>
Cc: Pradeep Jagadeesh <pradeep.jagadeesh@huawei.com>,
alberto garcia <berto@igalia.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
jani kokkonen <jani.kokkonen@huawei.com>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v13 4/6] hmp: create a throttle initialization function for code reuse
Date: Mon, 2 Oct 2017 10:33:30 -0400 [thread overview]
Message-ID: <1506954812-6552-5-git-send-email-pradeep.jagadeesh@huawei.com> (raw)
In-Reply-To: <1506954812-6552-1-git-send-email-pradeep.jagadeesh@huawei.com>
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>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hmp.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/hmp.c b/hmp.c
index ace729d..904fc4a 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1766,20 +1766,28 @@ void hmp_change(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
}
+static void hmp_initialize_throttle_limits(ThrottleLimits *iot,
+ const QDict *qdict)
+{
+ iot->bps_total = qdict_get_int(qdict, "bps");
+ iot->bps_read = qdict_get_int(qdict, "bps_rd");
+ iot->bps_write = qdict_get_int(qdict, "bps_wr");
+ iot->iops_total = qdict_get_int(qdict, "iops");
+ iot->iops_read = qdict_get_int(qdict, "iops_rd");
+ iot->iops_write = qdict_get_int(qdict, "iops_wr");
+}
+
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
+ ThrottleLimits *tlimits;
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"),
};
+ tlimits = qapi_BlockIOThrottle_base(&throttle);
+ hmp_initialize_throttle_limits(tlimits, qdict);
qmp_block_set_io_throttle(&throttle, &err);
hmp_handle_error(mon, &err);
}
--
1.8.3.1
next prev parent reply other threads:[~2017-10-02 14:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 14:33 [Qemu-devel] [PATCH v13 0/6] fsdev: qmp interface for io throttling Pradeep Jagadeesh
2017-10-02 14:33 ` [Qemu-devel] [PATCH v13 1/6] throttle: factor out duplicate code Pradeep Jagadeesh
2017-10-02 14:33 ` [Qemu-devel] [PATCH v13 2/6] qmp: Use ThrottleLimits structure Pradeep Jagadeesh
2017-10-13 14:16 ` Alberto Garcia
2017-10-13 14:26 ` Eric Blake
2017-11-02 10:25 ` Pradeep Jagadeesh
2017-11-06 9:35 ` Manos Pitsidianakis
2017-11-06 12:52 ` Pradeep Jagadeesh
2017-11-13 13:02 ` Pradeep Jagadeesh
2017-10-02 14:33 ` [Qemu-devel] [PATCH v13 3/6] qmp: factor out throttle code to reuse code Pradeep Jagadeesh
2017-10-13 14:29 ` Alberto Garcia
2017-11-02 10:55 ` Pradeep Jagadeesh
2017-11-02 11:00 ` Alberto Garcia
2017-11-02 12:03 ` Pradeep Jagadeesh
2017-10-02 14:33 ` Pradeep Jagadeesh [this message]
2017-10-02 14:33 ` [Qemu-devel] [PATCH v13 5/6] fsdev: QMP interface for throttling Pradeep Jagadeesh
2017-10-02 14:33 ` [Qemu-devel] [PATCH v13 6/6] fsdev: hmp " Pradeep Jagadeesh
2017-10-13 13:55 ` Alberto Garcia
2017-10-02 15:34 ` [Qemu-devel] [PATCH v13 0/6] fsdev: qmp interface for io throttling no-reply
2017-12-06 16:07 ` Greg Kurz
2017-12-06 16:15 ` Pradeep Jagadeesh
2017-12-06 16:49 ` Eric Blake
2017-12-06 17:12 ` 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=1506954812-6552-5-git-send-email-pradeep.jagadeesh@huawei.com \
--to=pradeepkiruvale@gmail.com \
--cc=berto@igalia.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=groug@kaod.org \
--cc=jani.kokkonen@huawei.com \
--cc=pradeep.jagadeesh@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).