From patchwork Fri Apr 5 13:28:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 234131 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 E86E92C00BE for ; Sat, 6 Apr 2013 00:29:05 +1100 (EST) Received: from localhost ([::1]:51648 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO6hU-0003aP-4R for incoming@patchwork.ozlabs.org; Fri, 05 Apr 2013 09:29:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48591) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO6gu-0003Xu-7j for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO6gt-0007zj-1h for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:28:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO6gs-0007zS-Qk for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:28:26 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r35DSPbP028812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 5 Apr 2013 09:28:25 -0400 Received: from dhcp-200-207.str.redhat.com (ovpn-116-95.ams2.redhat.com [10.36.116.95]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r35DSG3p003635; Fri, 5 Apr 2013 09:28:24 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 5 Apr 2013 15:28:07 +0200 Message-Id: <1365168490-29616-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1365168490-29616-1-git-send-email-kwolf@redhat.com> References: <1365168490-29616-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 5/8] 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 From: Stefan Hajnoczi 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 Tested-By: Benoit Canet Signed-off-by: Kevin Wolf --- block.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/block.c b/block.c index 00eca27..aa16fc4 100644 --- a/block.c +++ b/block.c @@ -3867,10 +3867,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));