From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH 3/4] block: set job->speed in block_set_speed
Date: Fri, 30 Mar 2012 13:17:12 +0200 [thread overview]
Message-ID: <1333106233-12472-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1333106233-12472-1-git-send-email-pbonzini@redhat.com>
There is no need to do this in every implementation of set_speed
(even though there is only one right now).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
block.c | 8 +++++++-
block/stream.c | 1 -
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/block.c b/block.c
index f244f99..3b6065b 100644
--- a/block.c
+++ b/block.c
@@ -4065,10 +4065,16 @@ void block_job_complete(BlockJob *job, int ret)
int block_job_set_speed(BlockJob *job, int64_t value)
{
+ int rc;
+
if (!job->job_type->set_speed) {
return -ENOTSUP;
}
- return job->job_type->set_speed(job, value);
+ rc = job->job_type->set_speed(job, value);
+ if (rc == 0) {
+ job->speed = value;
+ }
+ return rc;
}
void block_job_cancel(BlockJob *job)
diff --git a/block/stream.c b/block/stream.c
index f186bfd..61ff7a2 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -236,7 +236,6 @@ static int stream_set_speed(BlockJob *job, int64_t value)
if (value < 0) {
return -EINVAL;
}
- job->speed = value;
ratelimit_set_speed(&s->limit, value / BDRV_SECTOR_SIZE);
return 0;
}
--
1.7.9.1
next prev parent reply other threads:[~2012-03-30 11:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 11:17 [Qemu-devel] [PATCH 0/4] Job API improvements and bugfixes Paolo Bonzini
2012-03-30 11:17 ` [Qemu-devel] [PATCH 1/4] block: cancel jobs when a device is ready to go away Paolo Bonzini
2012-04-02 15:38 ` Kevin Wolf
2012-03-30 11:17 ` [Qemu-devel] [PATCH 2/4] block: fix streaming/closing race Paolo Bonzini
2012-03-30 13:32 ` Stefan Hajnoczi
2012-03-30 11:17 ` Paolo Bonzini [this message]
2012-03-30 11:17 ` [Qemu-devel] [PATCH 4/4] block: document job API Paolo Bonzini
2012-03-30 13:42 ` [Qemu-devel] [PATCH 0/4] Job API improvements and bugfixes Stefan Hajnoczi
2012-04-02 15:41 ` Kevin Wolf
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=1333106233-12472-4-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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).