ia64/xen-unstable

changeset 8210:8754277cec01

Fix blkback request notification holdoff. req_cons must be
updated before make_response() is called. This fixes attaching
ramdisk-backed vbds to a blkfront.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Dec 03 11:41:49 2005 +0100 (2005-12-03)
parents 4c588e255c85
children 4146dbea47e1 31d86fc0a271
files linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 03 11:00:03 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 03 11:41:49 2005 +0100
     1.3 @@ -296,22 +296,23 @@ static int do_block_io_op(blkif_t *blkif
     1.4  {
     1.5  	blkif_back_ring_t *blk_ring = &blkif->blk_ring;
     1.6  	blkif_request_t *req;
     1.7 -	RING_IDX i, rp;
     1.8 +	RING_IDX rc, rp;
     1.9  	int more_to_do = 0;
    1.10  
    1.11 +	rc = blk_ring->req_cons;
    1.12  	rp = blk_ring->sring->req_prod;
    1.13  	rmb(); /* Ensure we see queued requests up to 'rp'. */
    1.14  
    1.15 -	for (i = blk_ring->req_cons; 
    1.16 -	     (i != rp) && !RING_REQUEST_CONS_OVERFLOW(blk_ring, i);
    1.17 -	     i++) {
    1.18 +	while ((rc != rp) && !RING_REQUEST_CONS_OVERFLOW(blk_ring, rc)) {
    1.19  		if ((max_to_do-- == 0) ||
    1.20  		    (NR_PENDING_REQS == MAX_PENDING_REQS)) {
    1.21  			more_to_do = 1;
    1.22  			break;
    1.23  		}
    1.24 -        
    1.25 -		req = RING_GET_REQUEST(blk_ring, i);
    1.26 +
    1.27 +		req = RING_GET_REQUEST(blk_ring, rc);
    1.28 +		blk_ring->req_cons = ++rc; /* before make_response() */
    1.29 +
    1.30  		switch (req->operation) {
    1.31  		case BLKIF_OP_READ:
    1.32  		case BLKIF_OP_WRITE:
    1.33 @@ -327,7 +328,6 @@ static int do_block_io_op(blkif_t *blkif
    1.34  		}
    1.35  	}
    1.36  
    1.37 -	blk_ring->req_cons = i;
    1.38  	return more_to_do;
    1.39  }
    1.40