linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Zheng Liu <gnehzuil.liu@gmail.com>
Cc: linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>,
	Jan Kara <jack@suse.cz>
Subject: Re: [PATCH] jbd: use kmem_cache_zalloc for allocating journal head
Date: Mon, 29 Apr 2013 14:34:42 +0200	[thread overview]
Message-ID: <20130429123442.GA21982@quack.suse.cz> (raw)
In-Reply-To: <1367226531-3027-1-git-send-email-wenqing.lz@taobao.com>

On Mon 29-04-13 17:08:51, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> This commit tries to use kmem_cache_zalloc instead of kmem_cache_alloc/
> memset when a new journal head is alloctated.
  Thanks. Merged.

								Honza
> 
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> Cc: Jan Kara <jack@suse.cz>
> ---
> Hi Jan,
> 
> This patch could be folded into the commit that you have applied:
>   jbd: use kmem_cache_zalloc instead of kmem_cache_alloc/memset
> 
> Regards,
> 						- Zheng
> 
>  fs/jbd/journal.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
> index 81cc7ea..c5a6926 100644
> --- a/fs/jbd/journal.c
> +++ b/fs/jbd/journal.c
> @@ -1845,7 +1845,7 @@ static struct journal_head *journal_alloc_journal_head(void)
>  #ifdef CONFIG_JBD_DEBUG
>  	atomic_inc(&nr_journal_heads);
>  #endif
> -	ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
> +	ret = kmem_cache_zalloc(journal_head_cache, GFP_NOFS);
>  	if (ret == NULL) {
>  		jbd_debug(1, "out of memory for journal_head\n");
>  		printk_ratelimited(KERN_NOTICE "ENOMEM in %s, retrying.\n",
> @@ -1853,7 +1853,7 @@ static struct journal_head *journal_alloc_journal_head(void)
>  
>  		while (ret == NULL) {
>  			yield();
> -			ret = kmem_cache_alloc(journal_head_cache, GFP_NOFS);
> +			ret = kmem_cache_zalloc(journal_head_cache, GFP_NOFS);
>  		}
>  	}
>  	return ret;
> @@ -1915,10 +1915,8 @@ struct journal_head *journal_add_journal_head(struct buffer_head *bh)
>  	struct journal_head *new_jh = NULL;
>  
>  repeat:
> -	if (!buffer_jbd(bh)) {
> +	if (!buffer_jbd(bh))
>  		new_jh = journal_alloc_journal_head();
> -		memset(new_jh, 0, sizeof(*new_jh));
> -	}
>  
>  	jbd_lock_bh_journal_head(bh);
>  	if (buffer_jbd(bh)) {
> -- 
> 1.7.12.rc2.18.g61b472e
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2013-04-29 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-29  9:08 [PATCH] jbd: use kmem_cache_zalloc for allocating journal head Zheng Liu
2013-04-29 12:34 ` Jan Kara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130429123442.GA21982@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=gnehzuil.liu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=wenqing.lz@taobao.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).