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>
This commit is contained in:
parent
a8901d3487
commit
670be5a78a
1 changed files with 2 additions and 6 deletions
|
@ -43,6 +43,7 @@
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
#include <linux/backing-dev.h>
|
#include <linux/backing-dev.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
|
#include <linux/ratelimit.h>
|
||||||
|
|
||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include <trace/events/jbd2.h>
|
#include <trace/events/jbd2.h>
|
||||||
|
@ -1982,7 +1983,6 @@ static void jbd2_journal_destroy_jbd2_journal_head_cache(void)
|
||||||
static struct journal_head *journal_alloc_journal_head(void)
|
static struct journal_head *journal_alloc_journal_head(void)
|
||||||
{
|
{
|
||||||
struct journal_head *ret;
|
struct journal_head *ret;
|
||||||
static unsigned long last_warning;
|
|
||||||
|
|
||||||
#ifdef CONFIG_JBD2_DEBUG
|
#ifdef CONFIG_JBD2_DEBUG
|
||||||
atomic_inc(&nr_journal_heads);
|
atomic_inc(&nr_journal_heads);
|
||||||
|
@ -1990,11 +1990,7 @@ static struct journal_head *journal_alloc_journal_head(void)
|
||||||
ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
|
ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
jbd_debug(1, "out of memory for journal_head\n");
|
jbd_debug(1, "out of memory for journal_head\n");
|
||||||
if (time_after(jiffies, last_warning + 5*HZ)) {
|
pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__);
|
||||||
printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
|
|
||||||
__func__);
|
|
||||||
last_warning = jiffies;
|
|
||||||
}
|
|
||||||
while (!ret) {
|
while (!ret) {
|
||||||
yield();
|
yield();
|
||||||
ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
|
ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
|
||||||
|
|
Loading…
Add table
Reference in a new issue