ia64/xen-unstable

changeset 14681:6898d8ae7ae4

blktap: Fix qcow2raw.

qcow2raw would hang the conversion just short of 100%, because the
final write queue was never being submitted. If a blktap drivers read
synchronously, then "submit_events" and "complete" variables are
checked before getting set, so the fact that reads have finished is
not noticed, so the final write queue was never submitted.

Note that I have also removed the variables write_complete and
read_complete. They were unused, and they were also not set correctly
in the synchronous case.

Signed-off-by: Charles Coffing <ccoffing@novell.com>
author Keir Fraser <keir@xensource.com>
date Sat Mar 31 12:24:55 2007 +0100 (2007-03-31)
parents c1578c694b39
children 2de267ba9a76
files tools/blktap/drivers/qcow2raw.c
line diff
     1.1 --- a/tools/blktap/drivers/qcow2raw.c	Sat Mar 31 12:20:31 2007 +0100
     1.2 +++ b/tools/blktap/drivers/qcow2raw.c	Sat Mar 31 12:24:55 2007 +0100
     1.3 @@ -51,7 +51,6 @@
     1.4  #define BLOCK_PROCESSSZ 4096
     1.5  
     1.6  static int maxfds, *qcowio_fd, *aio_fd, running = 1, complete = 0; 
     1.7 -static int read_complete = 0, write_complete = 0;
     1.8  static int returned_read_events = 0, returned_write_events = 0;
     1.9  static int submit_events = 0;
    1.10  static uint32_t read_idx = 0, write_idx = 0;
    1.11 @@ -109,8 +108,6 @@ static int send_write_responses(struct d
    1.12  	written += BLOCK_PROCESSSZ;
    1.13  	returned_write_events++;
    1.14  	write_idx = idx;
    1.15 -	if (complete && (returned_write_events == submit_events)) 
    1.16 -		write_complete = 1;
    1.17  
    1.18  	debug_output(written, dd->td_state->size << 9);
    1.19  	free(private);
    1.20 @@ -126,8 +123,6 @@ static int send_read_responses(struct di
    1.21  	
    1.22  	returned_read_events++;
    1.23  	read_idx = idx;
    1.24 -	if (complete && (returned_read_events == submit_events)) 
    1.25 -		read_complete = 1;
    1.26  	
    1.27  	ret = ddaio.drv->td_queue_write(&ddaio, idx, BLOCK_PROCESSSZ>>9, private, 
    1.28  					send_write_responses, idx, private);
    1.29 @@ -136,7 +131,7 @@ static int send_read_responses(struct di
    1.30  		return 0;
    1.31  	}
    1.32  
    1.33 -	if ( (complete && returned_read_events == submit_events) || 
    1.34 +	if ( (returned_read_events == submit_events) || 
    1.35  	     (returned_read_events % 10 == 0) ) {
    1.36  		ddaio.drv->td_submit(&ddaio);
    1.37  	}
    1.38 @@ -299,6 +294,7 @@ int main(int argc, char *argv[])
    1.39  			}
    1.40  		
    1.41  			/*Attempt to read 4k sized blocks*/
    1.42 +			submit_events++;
    1.43  			ret = ddqcow.drv->td_queue_read(&ddqcow, i>>9,
    1.44  							BLOCK_PROCESSSZ>>9, buf, 
    1.45  							send_read_responses, i>>9, buf);
    1.46 @@ -309,7 +305,6 @@ int main(int argc, char *argv[])
    1.47  				exit(-1);
    1.48  			} else {
    1.49  				i += BLOCK_PROCESSSZ;
    1.50 -				submit_events++;
    1.51  			}
    1.52  
    1.53  			if (i >= ddqcow.td_state->size<<9) {