block: set job->speed in block_set_speed
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> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
		
							parent
							
								
									3e914655f2
								
							
						
					
					
						commit
						9f25eccc1c
					
				
							
								
								
									
										8
									
								
								block.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								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) | ||||
|  | ||||
| @ -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; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Paolo Bonzini
						Paolo Bonzini