ia64/xen-unstable

changeset 8221:bbef89ec44b8

Fix request-notification holdoff in blkback. New code is
more correct and clearer in intent.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Dec 03 21:53:01 2005 +0100 (2005-12-03)
parents d24ab5abf857
children 9b842cdbe0de
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 21:17:11 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c	Sat Dec 03 21:53:01 2005 +0100
     1.3 @@ -483,23 +483,22 @@ static void make_response(blkif_t *blkif
     1.4  	blkif_back_ring_t *blk_ring = &blkif->blk_ring;
     1.5  	int notify;
     1.6  
     1.7 +	spin_lock_irqsave(&blkif->blk_ring_lock, flags);
     1.8 +
     1.9  	/* Place on the response ring for the relevant domain. */ 
    1.10 -	spin_lock_irqsave(&blkif->blk_ring_lock, flags);
    1.11  	resp = RING_GET_RESPONSE(blk_ring, blk_ring->rsp_prod_pvt);
    1.12  	resp->id        = id;
    1.13  	resp->operation = op;
    1.14  	resp->status    = st;
    1.15  	blk_ring->rsp_prod_pvt++;
    1.16  	RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(blk_ring, notify);
    1.17 -	spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);
    1.18  
    1.19  	/*
    1.20           * Tail check for pending requests. Allows frontend to avoid
    1.21           * notifications if requests are already in flight (lower overheads
    1.22           * and promotes batching).
    1.23           */
    1.24 -	mb();
    1.25 -	if (!__on_blkdev_list(blkif)) {
    1.26 +	if (blk_ring->rsp_prod_pvt == blk_ring->req_cons) {
    1.27  		int more_to_do;
    1.28  		RING_FINAL_CHECK_FOR_REQUESTS(blk_ring, more_to_do);
    1.29  		if (more_to_do) {
    1.30 @@ -508,6 +507,8 @@ static void make_response(blkif_t *blkif
    1.31  		}
    1.32  	}
    1.33  
    1.34 +	spin_unlock_irqrestore(&blkif->blk_ring_lock, flags);
    1.35 +
    1.36  	if (notify)
    1.37  		notify_remote_via_irq(blkif->irq);
    1.38  }