From patchwork Thu Mar 21 14:49:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 229721 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 B38382C00C3 for ; Fri, 22 Mar 2013 01:51:22 +1100 (EST) Received: from localhost ([::1]:52746 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIgps-0003E8-Ui for incoming@patchwork.ozlabs.org; Thu, 21 Mar 2013 10:51:20 -0400 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 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2LEoKAO026446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Mar 2013 10:50:20 -0400 Received: from localhost (ovpn-112-35.ams2.redhat.com [10.36.112.35]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2LEoIo4020094; Thu, 21 Mar 2013 10:50:19 -0400 From: Stefan Hajnoczi To: 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , =?UTF-8?q?Beno=C3=AEt=20Canet?= , Stefan Hajnoczi , Zhi Yong Wu Subject: [Qemu-devel] [RFC 3/4] block: drop duplicated slice extension code 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 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));