Received: from eggs.gnu.org ([208.118.235.92]:44080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIgp6-0003A7-N9 for qemu-devel@nongnu.org; Thu, 21 Mar 2013 10:50:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIgp2-0002Hl-9t for qemu-devel@nongnu.org; Thu, 21 Mar 2013 10:50:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIgp2-0002HJ-2M for qemu-devel@nongnu.org; Thu, 21 Mar 2013 10:50:28 -0400 From: Stefan Hajnoczi Date: Thu, 21 Mar 2013 15:49:58 +0100 Message-Id: <1363877399-16339-4-git-send-email-stefanha@redhat.com> In-Reply-To: <1363877399-16339-1-git-send-email-stefanha@redhat.com> References: <1363877399-16339-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [RFC 3/4] block: drop duplicated slice extension code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , =?UTF-8?q?Beno=C3=AEt=20Canet?= , Stefan Hajnoczi , Zhi Yong Wu The current slice is extended when an I/O request exceeds the limit. There is no need to extend the slice every time we check a request. Signed-off-by: Stefan Hajnoczi --- block.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block.c b/block.c index 712f544..fed3b4d 100644 --- a/block.c +++ b/block.c @@ -3766,10 +3766,7 @@ static bool bdrv_exceed_io_limits(BlockDriverState *bs, int nb_sectors, int bps_ret, iops_ret; now = qemu_get_clock_ns(vm_clock); - if ((bs->slice_start < now) - && (bs->slice_end > now)) { - bs->slice_end = now + BLOCK_IO_SLICE_TIME; - } else { + if (now > bs->slice_end) { bs->slice_start = now; bs->slice_end = now + BLOCK_IO_SLICE_TIME; memset(&bs->slice_submitted, 0, sizeof(bs->slice_submitted)); -- 1.8.1.4