mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
Block layer patches
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJZr/vJAAoJEH8JsnLIjy/WrNMP/RMlpIfzjPTIKl1qwdxEbtEe kdsQulnSILVAWnXldB6xiQ8/epO2oTP+8sE9VCAoblQfJjD6RgffF1YCC7h1ZyBX 182ZnhapIwprH5RLKz/kgjfkx5/bCYjqpQ3JzznKJHNXJOAexznrYJMcbA2agfII 5qijA06dDoMIQTz49J2vvFAHrRUq/JqK85Ao8Zk41GDHDan5OfvQwsgt+Wa0V3vz mV6G1UsWCe4pmrv7v7/buhkVypy/BYz7vu6N20+2o3GDLwHmsgfKogUiSAC1N3iR olkeKtXdplY17iO6VgVrmFdkvaja0XCxYJjXnL54x/f1lQQQc01wUFNrh6WoIQLO Bl+XZ0oEQpFKJeBlu9mbDvgit0AGYE/yaLkCnfRFOU15lW5rjwqpF8husU0ntUcI TzGWt21kG0EXisejLMGEzEkMwkdhTwX6U+U7x5pF+x+pwSdcREDekeFcVhsb42Y/ brTgZCXdf32eJ8gOSzFoBJ5KfFaCqKgA6lWAv/kLsVs8DN+MnAv3SJGRBr22854W yJC5e3yLh36RVemjBqbqsU9VMD/P8fB3nJQwZRMyQh5A3RNxrK1y6e4XIqRwGqcC aj4cT2GbLWFH+EJUVdSRELmrLJPLyj5a1lU28Dq6b2Q34f9Hvg8GjSBOFf+4Vx6C N/z6+8O1mDtXdGHuCbmI =qJjo -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging Block layer patches # gpg: Signature made Wed 06 Sep 2017 14:44:41 BST # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: qcow2: move qcow2_store_persistent_dirty_bitmaps() before cache flushing qemu-iotests: add 184 for throttle filter driver block: add throttle block filter driver block: convert ThrottleGroup to object with QOM block: tidy ThrottleGroupMember initializations block: add aio_context field in ThrottleGroupMember block: move ThrottleGroup membership to ThrottleGroupMember block: document semantics of bdrv_co_preadv|pwritev qcow: Check failure of bdrv_getlength() and bdrv_truncate() qcow: Change signature of get_cluster_offset() block: add default implementations for bdrv_co_get_block_status() block: remove bdrv_truncate callback in blkdebug block: remove unused bdrv_media_changed block: pass bdrv_* methods to bs->file by default in block filters Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
8ee5f9b3ec
26 changed files with 1885 additions and 452 deletions
151
util/throttle.c
151
util/throttle.c
|
@ -484,3 +484,154 @@ void throttle_account(ThrottleState *ts, bool is_write, uint64_t size)
|
|||
}
|
||||
}
|
||||
|
||||
/* return a ThrottleConfig based on the options in a ThrottleLimits
|
||||
*
|
||||
* @arg: the ThrottleLimits object to read from
|
||||
* @cfg: the ThrottleConfig to edit
|
||||
* @errp: error object
|
||||
*/
|
||||
void throttle_limits_to_config(ThrottleLimits *arg, ThrottleConfig *cfg,
|
||||
Error **errp)
|
||||
{
|
||||
if (arg->has_bps_total) {
|
||||
cfg->buckets[THROTTLE_BPS_TOTAL].avg = arg->bps_total;
|
||||
}
|
||||
if (arg->has_bps_read) {
|
||||
cfg->buckets[THROTTLE_BPS_READ].avg = arg->bps_read;
|
||||
}
|
||||
if (arg->has_bps_write) {
|
||||
cfg->buckets[THROTTLE_BPS_WRITE].avg = arg->bps_write;
|
||||
}
|
||||
|
||||
if (arg->has_iops_total) {
|
||||
cfg->buckets[THROTTLE_OPS_TOTAL].avg = arg->iops_total;
|
||||
}
|
||||
if (arg->has_iops_read) {
|
||||
cfg->buckets[THROTTLE_OPS_READ].avg = arg->iops_read;
|
||||
}
|
||||
if (arg->has_iops_write) {
|
||||
cfg->buckets[THROTTLE_OPS_WRITE].avg = arg->iops_write;
|
||||
}
|
||||
|
||||
if (arg->has_bps_total_max) {
|
||||
cfg->buckets[THROTTLE_BPS_TOTAL].max = arg->bps_total_max;
|
||||
}
|
||||
if (arg->has_bps_read_max) {
|
||||
cfg->buckets[THROTTLE_BPS_READ].max = arg->bps_read_max;
|
||||
}
|
||||
if (arg->has_bps_write_max) {
|
||||
cfg->buckets[THROTTLE_BPS_WRITE].max = arg->bps_write_max;
|
||||
}
|
||||
if (arg->has_iops_total_max) {
|
||||
cfg->buckets[THROTTLE_OPS_TOTAL].max = arg->iops_total_max;
|
||||
}
|
||||
if (arg->has_iops_read_max) {
|
||||
cfg->buckets[THROTTLE_OPS_READ].max = arg->iops_read_max;
|
||||
}
|
||||
if (arg->has_iops_write_max) {
|
||||
cfg->buckets[THROTTLE_OPS_WRITE].max = arg->iops_write_max;
|
||||
}
|
||||
|
||||
if (arg->has_bps_total_max_length) {
|
||||
if (arg->bps_total_max_length > UINT_MAX) {
|
||||
error_setg(errp, "bps-total-max-length value must be in"
|
||||
" the range [0, %u]", UINT_MAX);
|
||||
return;
|
||||
}
|
||||
cfg->buckets[THROTTLE_BPS_TOTAL].burst_length = arg->bps_total_max_length;
|
||||
}
|
||||
if (arg->has_bps_read_max_length) {
|
||||
if (arg->bps_read_max_length > UINT_MAX) {
|
||||
error_setg(errp, "bps-read-max-length value must be in"
|
||||
" the range [0, %u]", UINT_MAX);
|
||||
return;
|
||||
}
|
||||
cfg->buckets[THROTTLE_BPS_READ].burst_length = arg->bps_read_max_length;
|
||||
}
|
||||
if (arg->has_bps_write_max_length) {
|
||||
if (arg->bps_write_max_length > UINT_MAX) {
|
||||
error_setg(errp, "bps-write-max-length value must be in"
|
||||
" the range [0, %u]", UINT_MAX);
|
||||
return;
|
||||
}
|
||||
cfg->buckets[THROTTLE_BPS_WRITE].burst_length = arg->bps_write_max_length;
|
||||
}
|
||||
if (arg->has_iops_total_max_length) {
|
||||
if (arg->iops_total_max_length > UINT_MAX) {
|
||||
error_setg(errp, "iops-total-max-length value must be in"
|
||||
" the range [0, %u]", UINT_MAX);
|
||||
return;
|
||||
}
|
||||
cfg->buckets[THROTTLE_OPS_TOTAL].burst_length = arg->iops_total_max_length;
|
||||
}
|
||||
if (arg->has_iops_read_max_length) {
|
||||
if (arg->iops_read_max_length > UINT_MAX) {
|
||||
error_setg(errp, "iops-read-max-length value must be in"
|
||||
" the range [0, %u]", UINT_MAX);
|
||||
return;
|
||||
}
|
||||
cfg->buckets[THROTTLE_OPS_READ].burst_length = arg->iops_read_max_length;
|
||||
}
|
||||
if (arg->has_iops_write_max_length) {
|
||||
if (arg->iops_write_max_length > UINT_MAX) {
|
||||
error_setg(errp, "iops-write-max-length value must be in"
|
||||
" the range [0, %u]", UINT_MAX);
|
||||
return;
|
||||
}
|
||||
cfg->buckets[THROTTLE_OPS_WRITE].burst_length = arg->iops_write_max_length;
|
||||
}
|
||||
|
||||
if (arg->has_iops_size) {
|
||||
cfg->op_size = arg->iops_size;
|
||||
}
|
||||
|
||||
throttle_is_valid(cfg, errp);
|
||||
}
|
||||
|
||||
/* write the options of a ThrottleConfig to a ThrottleLimits
|
||||
*
|
||||
* @cfg: the ThrottleConfig to read from
|
||||
* @var: the ThrottleLimits to write to
|
||||
*/
|
||||
void throttle_config_to_limits(ThrottleConfig *cfg, ThrottleLimits *var)
|
||||
{
|
||||
var->bps_total = cfg->buckets[THROTTLE_BPS_TOTAL].avg;
|
||||
var->bps_read = cfg->buckets[THROTTLE_BPS_READ].avg;
|
||||
var->bps_write = cfg->buckets[THROTTLE_BPS_WRITE].avg;
|
||||
var->iops_total = cfg->buckets[THROTTLE_OPS_TOTAL].avg;
|
||||
var->iops_read = cfg->buckets[THROTTLE_OPS_READ].avg;
|
||||
var->iops_write = cfg->buckets[THROTTLE_OPS_WRITE].avg;
|
||||
var->bps_total_max = cfg->buckets[THROTTLE_BPS_TOTAL].max;
|
||||
var->bps_read_max = cfg->buckets[THROTTLE_BPS_READ].max;
|
||||
var->bps_write_max = cfg->buckets[THROTTLE_BPS_WRITE].max;
|
||||
var->iops_total_max = cfg->buckets[THROTTLE_OPS_TOTAL].max;
|
||||
var->iops_read_max = cfg->buckets[THROTTLE_OPS_READ].max;
|
||||
var->iops_write_max = cfg->buckets[THROTTLE_OPS_WRITE].max;
|
||||
var->bps_total_max_length = cfg->buckets[THROTTLE_BPS_TOTAL].burst_length;
|
||||
var->bps_read_max_length = cfg->buckets[THROTTLE_BPS_READ].burst_length;
|
||||
var->bps_write_max_length = cfg->buckets[THROTTLE_BPS_WRITE].burst_length;
|
||||
var->iops_total_max_length = cfg->buckets[THROTTLE_OPS_TOTAL].burst_length;
|
||||
var->iops_read_max_length = cfg->buckets[THROTTLE_OPS_READ].burst_length;
|
||||
var->iops_write_max_length = cfg->buckets[THROTTLE_OPS_WRITE].burst_length;
|
||||
var->iops_size = cfg->op_size;
|
||||
|
||||
var->has_bps_total = true;
|
||||
var->has_bps_read = true;
|
||||
var->has_bps_write = true;
|
||||
var->has_iops_total = true;
|
||||
var->has_iops_read = true;
|
||||
var->has_iops_write = true;
|
||||
var->has_bps_total_max = true;
|
||||
var->has_bps_read_max = true;
|
||||
var->has_bps_write_max = true;
|
||||
var->has_iops_total_max = true;
|
||||
var->has_iops_read_max = true;
|
||||
var->has_iops_write_max = true;
|
||||
var->has_bps_read_max_length = true;
|
||||
var->has_bps_total_max_length = true;
|
||||
var->has_bps_write_max_length = true;
|
||||
var->has_iops_total_max_length = true;
|
||||
var->has_iops_read_max_length = true;
|
||||
var->has_iops_write_max_length = true;
|
||||
var->has_iops_size = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue