From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO6gz-0003gY-8V for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:28:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UO6gu-00080I-KW for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:28:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UO6gu-0007zz-C2 for qemu-devel@nongnu.org; Fri, 05 Apr 2013 09:28:28 -0400 From: Kevin Wolf Date: Fri, 5 Apr 2013 15:28:08 +0200 Message-Id: <1365168490-29616-7-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 6/8] block: clean up I/O throttling wait_time 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 wait_time variable is in seconds. Reflect this in a comment and use NANOSECONDS_PER_SECOND instead of BLOCK_IO_SLICE_TIME * 10 (which happens to have the right value). Signed-off-by: Stefan Hajnoczi Tested-By: Benoit Canet Signed-off-by: Kevin Wolf --- block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block.c b/block.c index aa16fc4..602d8a4 100644 --- a/block.c +++ b/block.c @@ -3800,7 +3800,7 @@ static bool bdrv_exceed_bps_limits(BlockDriverState *bs, int nb_sectors, BLOCK_IO_SLICE_TIME; bs->slice_end += extension; if (wait) { - *wait = wait_time * BLOCK_IO_SLICE_TIME * 10; + *wait = wait_time * NANOSECONDS_PER_SECOND; } return true; @@ -3841,7 +3841,7 @@ static bool bdrv_exceed_iops_limits(BlockDriverState *bs, bool is_write, return false; } - /* Calc approx time to dispatch */ + /* Calc approx time to dispatch, in seconds */ wait_time = (ios_base + 1) / iops_limit; if (wait_time > elapsed_time) { wait_time = wait_time - elapsed_time; @@ -3852,7 +3852,7 @@ static bool bdrv_exceed_iops_limits(BlockDriverState *bs, bool is_write, /* Exceeded current slice, extend it by another slice time */ bs->slice_end += BLOCK_IO_SLICE_TIME; if (wait) { - *wait = wait_time * BLOCK_IO_SLICE_TIME * 10; + *wait = wait_time * NANOSECONDS_PER_SECOND; } return true; -- 1.8.1.4