public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jbd: Use printk_ratelimit() in journal_alloc_journal_head()
@ 2010-10-04  9:17 Namhyung Kim
  2010-10-04  9:43 ` Jan Kara
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2010-10-04  9:17 UTC (permalink / raw)
  To: Andrew Morton, Jan Kara; +Cc: linux-ext4, linux-kernel

Use printk_ratelimit() instead of doing it manually.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 fs/jbd/journal.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 6f20a75..d66dd36 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -1718,7 +1718,6 @@ static void journal_destroy_journal_head_cache(void)
 static struct journal_head *journal_alloc_journal_head(void)
 {
 	struct journal_head *ret;
-	static unsigned long last_warning;
 
 #ifdef CONFIG_JBD_DEBUG
 	atomic_inc(&nr_journal_heads);
@@ -1726,11 +1725,10 @@ static struct journal_head *journal_alloc_journal_head(void)
 	ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
 	if (ret == NULL) {
 		jbd_debug(1, "out of memory for journal_head\n");
-		if (time_after(jiffies, last_warning + 5*HZ)) {
+		if (printk_ratelimit())
 			printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
 			       __func__);
-			last_warning = jiffies;
-		}
+
 		while (ret == NULL) {
 			yield();
 			ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
-- 
1.7.0.4


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

end of thread, other threads:[~2010-10-04 12:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-04  9:17 [PATCH] jbd: Use printk_ratelimit() in journal_alloc_journal_head() Namhyung Kim
2010-10-04  9:43 ` Jan Kara
2010-10-04 10:12   ` [PATCH UPDATED] jbd: Use printk_ratelimited() " Namhyung Kim
2010-10-04 10:31     ` Jan Kara
2010-10-04 11:37       ` Jan Kara
2010-10-04 12:20         ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox