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

* Re: [PATCH] jbd: Use printk_ratelimit() in journal_alloc_journal_head()
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kara @ 2010-10-04  9:43 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Jan Kara, linux-ext4, linux-kernel

On Mon 04-10-10 18:17:14, Namhyung Kim wrote:
>  #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;
> -		}
> +
  OK, but can we convert this directly to printk_ratelimited please?
Thanks.

								Honza

-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* [PATCH UPDATED] jbd: Use printk_ratelimited() in journal_alloc_journal_head()
  2010-10-04  9:43 ` Jan Kara
@ 2010-10-04 10:12   ` Namhyung Kim
  2010-10-04 10:31     ` Jan Kara
  0 siblings, 1 reply; 6+ messages in thread
From: Namhyung Kim @ 2010-10-04 10:12 UTC (permalink / raw)
  To: Jan Kara; +Cc: Andrew Morton, linux-ext4, linux-kernel

Use printk_ratelimited() instead of doing it manually.

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

diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 6f20a75..f79767d 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,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);
-- 
1.7.0.4


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

* Re: [PATCH UPDATED] jbd: Use printk_ratelimited() in journal_alloc_journal_head()
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kara @ 2010-10-04 10:31 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Jan Kara, Andrew Morton, linux-ext4, linux-kernel

On Mon 04-10-10 19:12:13, Namhyung Kim wrote:
> Use printk_ratelimited() instead of doing it manually.
  Thanks. I've merged the patch into my tree.

								Honza

> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  fs/jbd/journal.c |    9 +++------
>  1 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> index 6f20a75..f79767d 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,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);
> -- 
> 1.7.0.4
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

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

* Re: [PATCH UPDATED] jbd: Use printk_ratelimited() in journal_alloc_journal_head()
  2010-10-04 10:31     ` Jan Kara
@ 2010-10-04 11:37       ` Jan Kara
  2010-10-04 12:20         ` Namhyung Kim
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Kara @ 2010-10-04 11:37 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Jan Kara, Andrew Morton, linux-ext4, linux-kernel

On Mon 04-10-10 12:31:45, Jan Kara wrote:
> On Mon 04-10-10 19:12:13, Namhyung Kim wrote:
> > Use printk_ratelimited() instead of doing it manually.
>   Thanks. I've merged the patch into my tree.
  Grumble, you apparently didn't try to compile the thing... The patch
was missing #include <linux/ratelimit.h>. I've fixed that up now. Please be
more careful next time. Thanks.

 								Honza
> 
> > 
> > Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> > ---
> >  fs/jbd/journal.c |    9 +++------
> >  1 files changed, 3 insertions(+), 6 deletions(-)
> > 
> > diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> > index 6f20a75..f79767d 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,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);
> > -- 
> > 1.7.0.4
> > 
> -- 
> Jan Kara <jack@suse.cz>
> SUSE Labs, CR

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

* Re: [PATCH UPDATED] jbd: Use printk_ratelimited() in journal_alloc_journal_head()
  2010-10-04 11:37       ` Jan Kara
@ 2010-10-04 12:20         ` Namhyung Kim
  0 siblings, 0 replies; 6+ messages in thread
From: Namhyung Kim @ 2010-10-04 12:20 UTC (permalink / raw)
  To: Jan Kara; +Cc: Andrew Morton, linux-ext4, linux-kernel

2010-10-04 (월), 13:37 +0200, Jan Kara:
>   Grumble, you apparently didn't try to compile the thing... The patch
> was missing #include <linux/ratelimit.h>. I've fixed that up now. Please be
> more careful next time. Thanks.
> 
>  								Honza

Egads, I did compile-test but I forgot I did make allnoconfig before.
(And then I added ext3 support manually.) I'll double check a patch
before sending it in the future. Sorry for the inconvenience.

Thanks.

-- 
Regards,
Namhyung Kim



^ permalink raw reply	[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