From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Shen Feng <shen@cn.fujitsu.com>, Mingming Cao <cmm@us.ibm.com>
Cc: alex@clusterfs.com, Andrew Morton <akpm@linux-foundation.org>,
linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: error processing and coding enhancement for mballoc
Date: Wed, 28 May 2008 15:18:49 +0530 [thread overview]
Message-ID: <20080528094849.GC15851@skywalker> (raw)
In-Reply-To: <483BC796.9020402@cn.fujitsu.com>
On Tue, May 27, 2008 at 04:34:30PM +0800, Shen Feng wrote:
> *ext4_mb_seq_history_open: check if sbi->s_mb_history is NULL
> *ext4_mb_history_init: replace kmalloc and memset with kzalloc
> *ext4_mb_init_backend: remove memset since kzalloc is used
> *ext4_mb_init: the return value of ext4_mb_init_backend is int,
> but i is unsigned, replace it with a new int variable.
>
> Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
> fs/ext4/mballoc.c | 14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index add55f0..35c12db 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -1963,6 +1963,8 @@ static int ext4_mb_seq_history_open(struct inode *inode, struct file *file)
> int rc;
> int size;
>
> + if (unlikely(sbi->s_mb_history == NULL))
> + return -ENOMEM;
> s = kmalloc(sizeof(*s), GFP_KERNEL);
> if (s == NULL)
> return -ENOMEM;
> @@ -2165,9 +2167,7 @@ static void ext4_mb_history_init(struct super_block *sb)
> sbi->s_mb_history_cur = 0;
> spin_lock_init(&sbi->s_mb_history_lock);
> i = sbi->s_mb_history_max * sizeof(struct ext4_mb_history);
> - sbi->s_mb_history = kmalloc(i, GFP_KERNEL);
> - if (likely(sbi->s_mb_history != NULL))
> - memset(sbi->s_mb_history, 0, i);
> + sbi->s_mb_history = kzalloc(i, GFP_KERNEL);
> /* if we can't allocate history, then we simple won't use it */
> }
>
> @@ -2281,7 +2281,6 @@ static int ext4_mb_init_backend(struct super_block *sb)
> i++;
> goto err_freebuddy;
> }
> - memset(meta_group_info[j], 0, len);
> set_bit(EXT4_GROUP_INFO_NEED_INIT_BIT,
> &(meta_group_info[j]->bb_state));
>
> @@ -2336,6 +2335,7 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
> unsigned i;
> unsigned offset;
> unsigned max;
> + int ret;
>
> if (!test_opt(sb, MBALLOC))
> return 0;
> @@ -2370,12 +2370,12 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
> } while (i <= sb->s_blocksize_bits + 1);
>
> /* init file for buddy data */
> - i = ext4_mb_init_backend(sb);
> - if (i) {
> + ret = ext4_mb_init_backend(sb);
> + if (ret != 0) {
> clear_opt(sbi->s_mount_opt, MBALLOC);
> kfree(sbi->s_mb_offsets);
> kfree(sbi->s_mb_maxs);
> - return i;
> + return ret;
> }
>
> spin_lock_init(&sbi->s_md_lock);
> --
> 1.5.4.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-05-28 9:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-27 8:34 [PATCH] ext4: error processing and coding enhancement for mballoc Shen Feng
2008-05-28 9:48 ` Aneesh Kumar K.V [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=20080528094849.GC15851@skywalker \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alex@clusterfs.com \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=shen@cn.fujitsu.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