mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
block: Add iops_size to do the iops accounting for a given io size.
This feature can be used in case where users are avoiding the iops limit by doing jumbo I/Os hammering the storage backend. Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
3e9fab690d
commit
2024c1df43
6 changed files with 38 additions and 9 deletions
17
blockdev.c
17
blockdev.c
|
@ -507,7 +507,7 @@ static DriveInfo *blockdev_init(QemuOpts *all_opts,
|
|||
cfg.buckets[THROTTLE_OPS_WRITE].max =
|
||||
qemu_opt_get_number(opts, "throttling.iops-write-max", 0);
|
||||
|
||||
cfg.op_size = 0;
|
||||
cfg.op_size = qemu_opt_get_number(opts, "throttling.iops-size", 0);
|
||||
|
||||
if (!check_throttle_config(&cfg, &error)) {
|
||||
error_report("%s", error_get_pretty(error));
|
||||
|
@ -774,6 +774,9 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
|||
qemu_opt_rename(all_opts, "bps_rd_max", "throttling.bps-read-max");
|
||||
qemu_opt_rename(all_opts, "bps_wr_max", "throttling.bps-write-max");
|
||||
|
||||
qemu_opt_rename(all_opts,
|
||||
"iops_size", "throttling.iops-size");
|
||||
|
||||
qemu_opt_rename(all_opts, "readonly", "read-only");
|
||||
|
||||
value = qemu_opt_get(all_opts, "cache");
|
||||
|
@ -1273,7 +1276,9 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
|
|||
bool has_iops_rd_max,
|
||||
int64_t iops_rd_max,
|
||||
bool has_iops_wr_max,
|
||||
int64_t iops_wr_max, Error **errp)
|
||||
int64_t iops_wr_max,
|
||||
bool has_iops_size,
|
||||
int64_t iops_size, Error **errp)
|
||||
{
|
||||
ThrottleConfig cfg;
|
||||
BlockDriverState *bs;
|
||||
|
@ -1312,7 +1317,9 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
|
|||
cfg.buckets[THROTTLE_OPS_WRITE].max = iops_wr_max;
|
||||
}
|
||||
|
||||
cfg.op_size = 0;
|
||||
if (has_iops_size) {
|
||||
cfg.op_size = iops_size;
|
||||
}
|
||||
|
||||
if (!check_throttle_config(&cfg, errp)) {
|
||||
return;
|
||||
|
@ -2037,6 +2044,10 @@ QemuOptsList qemu_common_drive_opts = {
|
|||
.name = "throttling.bps-write-max",
|
||||
.type = QEMU_OPT_NUMBER,
|
||||
.help = "total bytes write burst",
|
||||
},{
|
||||
.name = "throttling.iops-size",
|
||||
.type = QEMU_OPT_NUMBER,
|
||||
.help = "when limiting by iops max size of an I/O in bytes",
|
||||
},{
|
||||
.name = "copy-on-read",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue