block: change block-job-set-speed argument from 'value' to 'speed'
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
9e6636c72d
commit
882ec7ce53
6
block.c
6
block.c
@ -4114,7 +4114,7 @@ void block_job_complete(BlockJob *job, int ret)
|
|||||||
bdrv_set_in_use(bs, 0);
|
bdrv_set_in_use(bs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void block_job_set_speed(BlockJob *job, int64_t value, Error **errp)
|
void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||||
{
|
{
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
@ -4122,13 +4122,13 @@ void block_job_set_speed(BlockJob *job, int64_t value, Error **errp)
|
|||||||
error_set(errp, QERR_NOT_SUPPORTED);
|
error_set(errp, QERR_NOT_SUPPORTED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
job->job_type->set_speed(job, value, &local_err);
|
job->job_type->set_speed(job, speed, &local_err);
|
||||||
if (error_is_set(&local_err)) {
|
if (error_is_set(&local_err)) {
|
||||||
error_propagate(errp, local_err);
|
error_propagate(errp, local_err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
job->speed = value;
|
job->speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void block_job_cancel(BlockJob *job)
|
void block_job_cancel(BlockJob *job)
|
||||||
|
@ -263,15 +263,15 @@ retry:
|
|||||||
block_job_complete(&s->common, ret);
|
block_job_complete(&s->common, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stream_set_speed(BlockJob *job, int64_t value, Error **errp)
|
static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||||
{
|
{
|
||||||
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
|
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
|
||||||
|
|
||||||
if (value < 0) {
|
if (speed < 0) {
|
||||||
error_set(errp, QERR_INVALID_PARAMETER, "value");
|
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ratelimit_set_speed(&s->limit, value / BDRV_SECTOR_SIZE);
|
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BlockJobType stream_job_type = {
|
static BlockJobType stream_job_type = {
|
||||||
|
@ -79,7 +79,7 @@ typedef struct BlockJobType {
|
|||||||
const char *job_type;
|
const char *job_type;
|
||||||
|
|
||||||
/** Optional callback for job types that support setting a speed limit */
|
/** Optional callback for job types that support setting a speed limit */
|
||||||
void (*set_speed)(BlockJob *job, int64_t value, Error **errp);
|
void (*set_speed)(BlockJob *job, int64_t speed, Error **errp);
|
||||||
} BlockJobType;
|
} BlockJobType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -380,7 +380,7 @@ void block_job_complete(BlockJob *job, int ret);
|
|||||||
* Set a rate-limiting parameter for the job; the actual meaning may
|
* Set a rate-limiting parameter for the job; the actual meaning may
|
||||||
* vary depending on the job type.
|
* vary depending on the job type.
|
||||||
*/
|
*/
|
||||||
void block_job_set_speed(BlockJob *job, int64_t value, Error **errp);
|
void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* block_job_cancel:
|
* block_job_cancel:
|
||||||
|
@ -1136,7 +1136,7 @@ static BlockJob *find_block_job(const char *device)
|
|||||||
return bs->job;
|
return bs->job;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qmp_block_job_set_speed(const char *device, int64_t value, Error **errp)
|
void qmp_block_job_set_speed(const char *device, int64_t speed, Error **errp)
|
||||||
{
|
{
|
||||||
BlockJob *job = find_block_job(device);
|
BlockJob *job = find_block_job(device);
|
||||||
|
|
||||||
@ -1145,7 +1145,7 @@ void qmp_block_job_set_speed(const char *device, int64_t value, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
block_job_set_speed(job, value, errp);
|
block_job_set_speed(job, speed, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void qmp_block_job_cancel(const char *device, Error **errp)
|
void qmp_block_job_cancel(const char *device, Error **errp)
|
||||||
|
@ -85,8 +85,8 @@ ETEXI
|
|||||||
|
|
||||||
{
|
{
|
||||||
.name = "block_job_set_speed",
|
.name = "block_job_set_speed",
|
||||||
.args_type = "device:B,value:o",
|
.args_type = "device:B,speed:o",
|
||||||
.params = "device value",
|
.params = "device speed",
|
||||||
.help = "set maximum speed for a background block operation",
|
.help = "set maximum speed for a background block operation",
|
||||||
.mhandler.cmd = hmp_block_job_set_speed,
|
.mhandler.cmd = hmp_block_job_set_speed,
|
||||||
},
|
},
|
||||||
|
@ -1592,7 +1592,7 @@
|
|||||||
#
|
#
|
||||||
# @device: the device name
|
# @device: the device name
|
||||||
#
|
#
|
||||||
# @value: the maximum speed, in bytes per second
|
# @speed: the maximum speed, in bytes per second
|
||||||
#
|
#
|
||||||
# Returns: Nothing on success
|
# Returns: Nothing on success
|
||||||
# If the job type does not support throttling, NotSupported
|
# If the job type does not support throttling, NotSupported
|
||||||
@ -1602,7 +1602,7 @@
|
|||||||
# Since: 1.1
|
# Since: 1.1
|
||||||
##
|
##
|
||||||
{ 'command': 'block-job-set-speed',
|
{ 'command': 'block-job-set-speed',
|
||||||
'data': { 'device': 'str', 'value': 'int' } }
|
'data': { 'device': 'str', 'speed': 'int' } }
|
||||||
|
|
||||||
##
|
##
|
||||||
# @block-job-cancel:
|
# @block-job-cancel:
|
||||||
|
@ -694,7 +694,7 @@ EQMP
|
|||||||
|
|
||||||
{
|
{
|
||||||
.name = "block-job-set-speed",
|
.name = "block-job-set-speed",
|
||||||
.args_type = "device:B,value:o",
|
.args_type = "device:B,speed:o",
|
||||||
.mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
|
.mhandler.cmd_new = qmp_marshal_input_block_job_set_speed,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user