mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Yi Wang <wang.yi59@zte.com.cn>, clm@fb.com
Cc: josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	xue.zhihong@zte.com.cn, wang.liang82@zte.com.cn,
	Liao Pingfang <liao.pingfang@zte.com.cn>
Subject: Re: [PATCH] btrfs: Replace kmalloc with kzalloc in the error message
Date: Thu, 28 May 2020 19:03:45 -0700	[thread overview]
Message-ID: <5418df56f217437bd33c4cb70098db29c177d5b3.camel@perches.com> (raw)
In-Reply-To: <1590714057-15468-1-git-send-email-wang.yi59@zte.com.cn>

On Fri, 2020-05-29 at 09:00 +0800, Yi Wang wrote:
> From: Liao Pingfang <liao.pingfang@zte.com.cn>
> 
> Use kzalloc instead of kmalloc in the error message according to
> the previous kzalloc() call.
[]
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
[]
> @@ -632,7 +632,7 @@ static int btrfsic_process_superblock(struct btrfsic_state *state,
>  
>  	selected_super = kzalloc(sizeof(*selected_super), GFP_NOFS);
>  	if (NULL == selected_super) {
> -		pr_info("btrfsic: error, kmalloc failed!\n");
> +		pr_info("btrfsic: error, kzalloc failed!\n");

As there is a dump_stack() done on memory allocation
failures, these messages might as well be deleted instead.

>  		return -ENOMEM;
>  	}
>  
> @@ -795,7 +795,7 @@ static int btrfsic_process_superblock_dev_mirror(
>  	if (NULL == superblock_tmp) {
>  		superblock_tmp = btrfsic_block_alloc();
>  		if (NULL == superblock_tmp) {
> -			pr_info("btrfsic: error, kmalloc failed!\n");
> +			pr_info("btrfsic: error, kzalloc failed!\n");

If these are really desired, it'd be likely be better
to describe the function that failed instead of whatever
internal memory allocation the function used.

Another option would be to add __GFP_NOWARN to the
allocation internal to btrfsic_block_alloc and then
change this to something like

		pr_info("btrfsic: error, btrfsic_block_alloc failed!\n");						}

or move this reporting into the btrfsic_block_alloc
function and remove the messages after each failure.

etc...



  reply	other threads:[~2020-05-29  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  1:00 Yi Wang
2020-05-29  2:03 ` Joe Perches [this message]
2020-05-29 13:05   ` David Sterba

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=5418df56f217437bd33c4cb70098db29c177d5b3.camel@perches.com \
    --to=joe@perches.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=liao.pingfang@zte.com.cn \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wang.liang82@zte.com.cn \
    --cc=wang.yi59@zte.com.cn \
    --cc=xue.zhihong@zte.com.cn \
    /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

all inboxes | Powered by JetHome®