From: Namhyung Kim Date: Mon, 4 Oct 2010 10:12:13 +0000 (+0900) Subject: jbd: Use printk_ratelimited() in journal_alloc_journal_head() X-Git-Tag: v2.6.37-rc1~78^2~19 X-Git-Url: https://bbs.cooldavid.org/git/?p=net-next-2.6.git;a=commitdiff_plain;h=f81e3d4564a06c5a070337ba527d11865acecb67 jbd: Use printk_ratelimited() in journal_alloc_journal_head() Use printk_ratelimited() instead of doing it manually. Signed-off-by: Namhyung Kim Signed-off-by: Jan Kara --- diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 2c4b1f109da..d7a86935553 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -1719,7 +1720,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); @@ -1727,11 +1727,9 @@ 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)) { - printk(KERN_NOTICE "ENOMEM in %s, retrying.\n", - __func__); - last_warning = jiffies; - } + printk_ratelimited(KERN_NOTICE "ENOMEM in %s, retrying.\n", + __func__); + while (ret == NULL) { yield(); ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);