aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2010-12-17 10:44:16 -0500
committerTheodore Ts'o <tytso@mit.edu>2010-12-17 10:44:16 -0500
commit670be5a78ac7c80f0d6009d648c84c65a03f373a (patch)
treee74adf62ba7d69540ddcb620cf45b6cf99cdedf8
parenta8901d34872dafcafa23efa0865dcecfd4fddf8c (diff)
jbd2: Use pr_notice_ratelimited() in journal_alloc_journal_head()
We had an open-coded version of printk_ratelimited(); use the provided abstraction to make the code cleaner and easier to understand. Based on a similar patch for fs/jbd from Namhyung Kim <namhyung@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--fs/jbd2/journal.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index f837ba953529..06dfd778cae5 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -43,6 +43,7 @@
43#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
44#include <linux/backing-dev.h> 44#include <linux/backing-dev.h>
45#include <linux/bitops.h> 45#include <linux/bitops.h>
46#include <linux/ratelimit.h>
46 47
47#define CREATE_TRACE_POINTS 48#define CREATE_TRACE_POINTS
48#include <trace/events/jbd2.h> 49#include <trace/events/jbd2.h>
@@ -1982,7 +1983,6 @@ static void jbd2_journal_destroy_jbd2_journal_head_cache(void)
1982static struct journal_head *journal_alloc_journal_head(void) 1983static struct journal_head *journal_alloc_journal_head(void)
1983{ 1984{
1984 struct journal_head *ret; 1985 struct journal_head *ret;
1985 static unsigned long last_warning;
1986 1986
1987#ifdef CONFIG_JBD2_DEBUG 1987#ifdef CONFIG_JBD2_DEBUG
1988 atomic_inc(&nr_journal_heads); 1988 atomic_inc(&nr_journal_heads);
@@ -1990,11 +1990,7 @@ static struct journal_head *journal_alloc_journal_head(void)
1990 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); 1990 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
1991 if (!ret) { 1991 if (!ret) {
1992 jbd_debug(1, "out of memory for journal_head\n"); 1992 jbd_debug(1, "out of memory for journal_head\n");
1993 if (time_after(jiffies, last_warning + 5*HZ)) { 1993 pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__);
1994 printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
1995 __func__);
1996 last_warning = jiffies;
1997 }
1998 while (!ret) { 1994 while (!ret) {
1999 yield(); 1995 yield();
2000 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS); 1996 ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);