On 3/23/2017 7:14 PM, Eric Blake wrote:
On 03/23/2017 09:46 AM, Eric Blake wrote:
On 03/23/2017 07:20 AM, Pradeep Jagadeesh wrote:
This patchset removes the throttle redundant code that was present
in block and fsdev files.
Signed-off-by: Pradeep Jagadeesh <pradeep.jagade...@huawei.com>
---
I think you want portions of this patch to come first; you want to
refactor out the IOThrottle portion of existing types, and then extend
IOThrottle to be used in more places.
For the record, here's a nice example of how to factor out common fields
into a new base class:
https://lists.gnu.org/archive/html/qemu-devel/2017-03/msg04649.html
Nice one, but If I do this way, I can not remove some duplicate code
from initialization code. For example below code.
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
- 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"),
- };
Also
void hmp_fsdev_set_io_throttle(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
- IOThrottle throttle = {
- .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"),
- };
-
Regards,
Pradeep