Received: from eggs.gnu.org ([2001:4830:134:3::10]:43588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHZU9-0006lG-OL for qemu-devel@nongnu.org; Wed, 13 Aug 2014 10:25:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHZU1-0007yO-D9 for qemu-devel@nongnu.org; Wed, 13 Aug 2014 10:25:05 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:52612 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHZU1-0007xw-6I for qemu-devel@nongnu.org; Wed, 13 Aug 2014 10:24:57 -0400 From: =?UTF-8?q?Beno=C3=AEt=20Canet?= Date: Wed, 13 Aug 2014 16:23:57 +0200 Message-Id: <1407939839-27483-7-git-send-email-benoit.canet@nodalink.com> In-Reply-To: <1407939839-27483-1-git-send-email-benoit.canet@nodalink.com> References: <1407939839-27483-1-git-send-email-benoit.canet@nodalink.com> Subject: [Qemu-devel] [RFC V2 6/8] throttle: Add a way to fire one of the timers asap like a bottom half List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Beno=C3=AEt=20Canet?= , stefanha@redhat.com This will be needed by the group throttling algorithm. Signed-off-by: Benoit Canet --- include/qemu/throttle.h | 2 ++ util/throttle.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h index 3a16c48..3b9d1b8 100644 --- a/include/qemu/throttle.h +++ b/include/qemu/throttle.h @@ -127,6 +127,8 @@ bool throttle_schedule_timer(ThrottleState *ts, bool is_write, bool *armed); +void throttle_fire_timer(ThrottleTimers *tt, bool is_write); + void throttle_timer_fired(ThrottleState *ts, bool is_write); void throttle_account(ThrottleState *ts, bool is_write, uint64_t size); diff --git a/util/throttle.c b/util/throttle.c index a273acb..163b9d0 100644 --- a/util/throttle.c +++ b/util/throttle.c @@ -403,6 +403,17 @@ bool throttle_schedule_timer(ThrottleState *ts, return true; } +/* Schedule a throttle timer like a BH + * + * @tt: The timers structure + * @is_write: the type of operation (read/write) + */ +void throttle_fire_timer(ThrottleTimers *tt, bool is_write) +{ + int64_t now = qemu_clock_get_ns(tt->clock_type); + timer_mod(tt->timers[is_write], now + 1); +} + /* Remember that now timers are currently armed * * @ts: the throttle state we are working on -- 2.1.0.rc1