From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Kevin Wolf 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> Subject: [Qemu-devel] [PATCH 5/8] block: drop duplicated slice extension code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@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)); -- 1.8.1.4