Received: from eggs.gnu.org ([2001:4830:134:3::10]:52207) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbUnM-0004CM-CK for qemu-devel@nongnu.org; Tue, 07 Oct 2014 09:27:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbUnG-0007iw-MJ for qemu-devel@nongnu.org; Tue, 07 Oct 2014 09:27:16 -0400 Received: from lputeaux-656-01-25-125.w80-12.abo.wanadoo.fr ([80.12.84.125]:60886 helo=paradis.irqsave.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbUnG-0007iY-FA for qemu-devel@nongnu.org; Tue, 07 Oct 2014 09:27:10 -0400 From: =?UTF-8?q?Beno=C3=AEt=20Canet?= Date: Tue, 7 Oct 2014 15:24:37 +0200 Message-Id: <1412688279-8312-7-git-send-email-benoit.canet@nodalink.com> In-Reply-To: <1412688279-8312-1-git-send-email-benoit.canet@nodalink.com> References: <1412688279-8312-1-git-send-email-benoit.canet@nodalink.com> Subject: [Qemu-devel] [PATCH v1 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, famz@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.1