All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ratelimit: add initialization macro
@ 2014-08-20 12:54 Dmitry Monakhov
  2014-08-20 12:54 ` [PATCH 2/2] fault-inject: add ratelimit option Dmitry Monakhov
  2014-10-19  9:06 ` [PATCH 1/2] ratelimit: add initialization macro Dmitry Monakhov
  0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Monakhov @ 2014-08-20 12:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: akinobu.mita, Dmitry Monakhov


Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
 include/linux/ratelimit.h |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 0a260d8..1810252 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -17,14 +17,20 @@ struct ratelimit_state {
 	unsigned long	begin;
 };
 
-#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
-									\
-	struct ratelimit_state name = {					\
+#define RATELIMIT_STATE_INIT(name, interval_init, burst_init) {		\
 		.lock		= __RAW_SPIN_LOCK_UNLOCKED(name.lock),	\
 		.interval	= interval_init,			\
 		.burst		= burst_init,				\
 	}
 
+#define RATELIMIT_STATE_INIT_DISABLED					\
+	RATELIMIT_STATE_INIT(ratelimit_state, 0, DEFAULT_RATELIMIT_BURST)
+
+#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init)		\
+									\
+	struct ratelimit_state name =					\
+		RATELIMIT_STATE_INIT(name, interval_init, burst_init)	\
+
 static inline void ratelimit_state_init(struct ratelimit_state *rs,
 					int interval, int burst)
 {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-19 12:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 12:54 [PATCH 1/2] ratelimit: add initialization macro Dmitry Monakhov
2014-08-20 12:54 ` [PATCH 2/2] fault-inject: add ratelimit option Dmitry Monakhov
2014-08-20 14:20   ` Akinobu Mita
2014-08-20 14:36     ` Dmitry Monakhov
2014-10-19  9:07       ` Dmitry Monakhov
2014-10-19 12:17         ` Akinobu Mita
2014-10-19  9:06 ` [PATCH 1/2] ratelimit: add initialization macro Dmitry Monakhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.