linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Adds ratelimit_state_init()
@ 2010-05-17  0:38 OGAWA Hirofumi
  2010-05-17  0:39 ` [PATCH 2/2] fat: ratelimit corruption report OGAWA Hirofumi
  2010-05-19 20:57 ` [PATCH 1/2] Adds ratelimit_state_init() Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: OGAWA Hirofumi @ 2010-05-17  0:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Hi,

Please review.

Andrew, this is the part of fatfs error ratelimit. I.e. fatfs change is
depending to this patch.

I guess this area usually is sent to you. But, if this patch
wasn't applied before fatfs change, fatfs will break.

Well, so, can I pass fatfs patch to you? Or, I should apply this to
fatfs-tree too?

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>


For now, all users of ratelimit_state allocates it statically, so
DEFINE_RATELIMIT_STATE() is enough. But, I want to use ratelimit_state
for fs, i.e. per super_block to suppress too many error reports.

So, this adds ratelimit_state_init() to initialize ratelimite_state
which is dynamically allocated, instead of opencoding.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---

 include/linux/ratelimit.h |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff -puN include/linux/ratelimit.h~ratelimit-enhance include/linux/ratelimit.h
--- linux-2.6/include/linux/ratelimit.h~ratelimit-enhance	2010-05-17 03:44:27.000000000 +0900
+++ linux-2.6-hirofumi/include/linux/ratelimit.h	2010-05-17 03:44:27.000000000 +0900
@@ -2,7 +2,7 @@
 #define _LINUX_RATELIMIT_H
 
 #include <linux/param.h>
-#include <linux/spinlock_types.h>
+#include <linux/spinlock.h>
 
 #define DEFAULT_RATELIMIT_INTERVAL	(5 * HZ)
 #define DEFAULT_RATELIMIT_BURST		10
@@ -25,6 +25,17 @@ struct ratelimit_state {
 		.burst		= burst_init,				\
 	}
 
+static inline void ratelimit_state_init(struct ratelimit_state *rs,
+					int interval, int burst)
+{
+	spin_lock_init(&rs->lock);
+	rs->interval = interval;
+	rs->burst = burst;
+	rs->printed = 0;
+	rs->missed = 0;
+	rs->begin = 0;
+}
+
 extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
 #define __ratelimit(state) ___ratelimit(state, __func__)
 
_

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

end of thread, other threads:[~2010-05-19 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-17  0:38 [PATCH 1/2] Adds ratelimit_state_init() OGAWA Hirofumi
2010-05-17  0:39 ` [PATCH 2/2] fat: ratelimit corruption report OGAWA Hirofumi
2010-05-19 20:57 ` [PATCH 1/2] Adds ratelimit_state_init() Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).