]> Git Repo - qemu.git/commitdiff
block: set job->speed in block_set_speed
authorPaolo Bonzini <[email protected]>
Fri, 30 Mar 2012 11:17:12 +0000 (13:17 +0200)
committerKevin Wolf <[email protected]>
Thu, 5 Apr 2012 12:54:40 +0000 (14:54 +0200)
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 <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block.c
block/stream.c

diff --git a/block.c b/block.c
index 16e14fa7d54495f5f02cd1d4d6c850db4c9a06c9..33630ebacc4cb8c98508b0102b9bb9d04bda78c5 100644 (file)
--- a/block.c
+++ b/block.c
@@ -4085,10 +4085,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)
index f186bfd4f573c798ca9ab03026ec4a7721a5edab..61ff7a236e2d24c5f57bfa817e066ae7120c9700 100644 (file)
@@ -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;
 }
This page took 0.032153 seconds and 4 git commands to generate.