From patchwork Thu May 10 15:37:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 158334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A3CCDB6F9D for ; Fri, 11 May 2012 01:38:08 +1000 (EST) Received: from localhost ([::1]:36590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSVRM-00054A-T0 for incoming@patchwork.ozlabs.org; Thu, 10 May 2012 11:38:04 -0400 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 Received: from EMEA1-MTA by nat28.tlf.novell.com with Novell_GroupWise; Thu, 10 May 2012 16:37:35 +0100 Message-Id: <4FABFCF40200007800082CE0@nat28.tlf.novell.com> X-Mailer: Novell GroupWise Internet Agent 12.0.0 Date: Thu, 10 May 2012 16:37:56 +0100 From: "Jan Beulich" To: "xen-devel" , Mime-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 130.57.49.28 Cc: Stefano Stabellini Subject: [Qemu-devel] qemu/xendisk: properly update stats in ioreq_release() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 qemu/xendisk: properly update stats in ioreq_release() 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++; } -static void ioreq_release(struct ioreq *ioreq) +static void ioreq_release(struct ioreq *ioreq, bool finish) { struct XenBlkDev *blkdev = ioreq->blkdev; @@ -162,7 +162,10 @@ static void ioreq_release(struct ioreq * memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev = blkdev; QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); - blkdev->requests_finished--; + if (finish) + blkdev->requests_finished--; + else + blkdev->requests_inflight--; } /* @@ -449,7 +452,7 @@ static void blk_send_response_all(struct while (!QLIST_EMPTY(&blkdev->finished)) { ioreq = QLIST_FIRST(&blkdev->finished); send_notify += 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; } --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -154,7 +154,7 @@ static void ioreq_finish(struct ioreq *i blkdev->requests_finished++; } -static void ioreq_release(struct ioreq *ioreq) +static void ioreq_release(struct ioreq *ioreq, bool finish) { struct XenBlkDev *blkdev = ioreq->blkdev; @@ -162,7 +162,10 @@ static void ioreq_release(struct ioreq * memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev = blkdev; QLIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); - blkdev->requests_finished--; + if (finish) + blkdev->requests_finished--; + else + blkdev->requests_inflight--; } /* @@ -449,7 +452,7 @@ static void blk_send_response_all(struct while (!QLIST_EMPTY(&blkdev->finished)) { ioreq = QLIST_FIRST(&blkdev->finished); send_notify += 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; }