Received: from eggs.gnu.org ([208.118.235.92]:58132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSVR7-00053c-C6 for qemu-devel@nongnu.org; Thu, 10 May 2012 11:37:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSVR2-0007rT-C2 for qemu-devel@nongnu.org; Thu, 10 May 2012 11:37:48 -0400 Received: from nat28.tlf.novell.com ([130.57.49.28]:40996) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSVR2-0007pi-1u for qemu-devel@nongnu.org; Thu, 10 May 2012 11:37:44 -0400 Message-Id: <4FABFCF40200007800082CE0@nat28.tlf.novell.com> Date: Thu, 10 May 2012 16:37:56 +0100 From: "Jan Beulich" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartA88641C4.2__=" Subject: [Qemu-devel] qemu/xendisk: properly update stats in ioreq_release() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: xen-devel , qemu-devel@nongnu.org Cc: Stefano Stabellini This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartA88641C4.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline While for the "normal" case (called from blk_send_response_all()) decrementing requests_finished is correct, doing so in the parse error case is wrong; requests_inflight needs to be decremented instead. Signed-off-by: Jan Beulich --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -154,7 +154,7 @@ static void ioreq_finish(struct ioreq *i blkdev->requests_finished++; } =20 -static void ioreq_release(struct ioreq *ioreq) +static void ioreq_release(struct ioreq *ioreq, bool finish) { struct XenBlkDev *blkdev =3D ioreq->blkdev; =20 @@ -162,7 +162,10 @@ static void ioreq_release(struct ioreq * memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev =3D blkdev; QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); - blkdev->requests_finished--; + if (finish) + blkdev->requests_finished--; + else + blkdev->requests_inflight--; } =20 /* @@ -449,7 +452,7 @@ static void blk_send_response_all(struct while (!QLIST_EMPTY(&blkdev->finished)) { ioreq =3D QLIST_FIRST(&blkdev->finished); send_notify +=3D blk_send_response_one(ioreq); - ioreq_release(ioreq); + ioreq_release(ioreq, true); } if (send_notify) { xen_be_send_notify(&blkdev->xendev); @@ -505,7 +508,7 @@ static void blk_handle_requests(struct X if (blk_send_response_one(ioreq)) { xen_be_send_notify(&blkdev->xendev); } - ioreq_release(ioreq); + ioreq_release(ioreq, false); continue; } =20 --=__PartA88641C4.2__= Content-Type: text/plain; name="qemu-xendisk-accounting.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="qemu-xendisk-accounting.patch" qemu/xendisk: properly update stats in ioreq_release()=0A=0AWhile for the = "normal" case (called from blk_send_response_all())=0Adecrementing = requests_finished is correct, doing so in the parse error=0Acase is wrong; = requests_inflight needs to be decremented instead.=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/hw/xen_disk.c=0A+++ b/hw/xen_disk.c= =0A@@ -154,7 +154,7 @@ static void ioreq_finish(struct ioreq *i=0A = blkdev->requests_finished++;=0A }=0A =0A-static void ioreq_release(struct = ioreq *ioreq)=0A+static void ioreq_release(struct ioreq *ioreq, bool = finish)=0A {=0A struct XenBlkDev *blkdev =3D ioreq->blkdev;=0A =0A@@ = -162,7 +162,10 @@ static void ioreq_release(struct ioreq *=0A = memset(ioreq, 0, sizeof(*ioreq));=0A ioreq->blkdev =3D blkdev;=0A = QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list);=0A- blkdev->requests_= finished--;=0A+ if (finish)=0A+ blkdev->requests_finished--;=0A+ = else=0A+ blkdev->requests_inflight--;=0A }=0A =0A /*=0A@@ -449,7 = +452,7 @@ static void blk_send_response_all(struct=0A while (!QLIST_EMP= TY(&blkdev->finished)) {=0A ioreq =3D QLIST_FIRST(&blkdev->finished= );=0A send_notify +=3D blk_send_response_one(ioreq);=0A- = ioreq_release(ioreq);=0A+ ioreq_release(ioreq, true);=0A }=0A = if (send_notify) {=0A xen_be_send_notify(&blkdev->xendev);=0A@@ = -505,7 +508,7 @@ static void blk_handle_requests(struct X=0A = if (blk_send_response_one(ioreq)) {=0A xen_be_send_notify(&= blkdev->xendev);=0A }=0A- ioreq_release(ioreq);=0A+ = ioreq_release(ioreq, false);=0A continue;=0A = }=0A =0A --=__PartA88641C4.2__=--