mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Minfei Huang <mhuang@redhat.com>
To: Minfei Huang <mnfhuang@gmail.com>
Cc: axboe@fb.com, m@bjorling.me, akinobu.mita@gmail.com,
	rusty@rustcorp.com.au, keith.busch@intel.com, mcgrof@suse.com,
	krinkin.m.u@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] null_blk: Do a cleanup for function null_add_dev
Date: Mon, 14 Dec 2015 19:43:35 +0800	[thread overview]
Message-ID: <20151214114335.GA21529@dhcp-128-25.nay.redhat.com> (raw)
In-Reply-To: <1448630773-4119-2-git-send-email-mnfhuang@gmail.com>

Ping, Jens.

Could you have any idea about this cleanup patch?

Thanks
Minfei

On 11/27/15 at 09:26pm, Minfei Huang wrote:
> If null block is a lightnvm device, it wouldn't need to allocate the
> variant disk. So it is fine to separate the code for lightnvm and normal
> device to use if/else.
> 
> Thus we don't never need the flag out_cleanup_lightnvm.
> 
> Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
> ---
>  drivers/block/null_blk.c | 42 +++++++++++++++++++-----------------------
>  1 file changed, 19 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index 729ecd7..7d5d2e7 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -739,32 +739,28 @@ static int null_add_dev(void)
>  							&null_lnvm_dev_ops);
>  		if (rv)
>  			goto out_cleanup_blk_list;
> -		goto done;
> -	}
> -
> -	disk = nullb->disk = alloc_disk_node(1, home_node);
> -	if (!disk) {
> -		rv = -ENOMEM;
> -		goto out_cleanup_lightnvm;
> +	} else {
> +		disk = nullb->disk = alloc_disk_node(1, home_node);
> +		if (!disk) {
> +			rv = -ENOMEM;
> +			goto out_cleanup_blk_list;
> +		}
> +		size = gb * 1024 * 1024 * 1024ULL;
> +		set_capacity(disk, size >> 9);
> +
> +		disk->flags |=
> +			GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO;
> +		disk->major		= null_major;
> +		disk->first_minor	= nullb->index;
> +		disk->fops		= &null_fops;
> +		disk->private_data	= nullb;
> +		disk->queue		= nullb->q;
> +		strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
> +
> +		add_disk(disk);
>  	}
> -	size = gb * 1024 * 1024 * 1024ULL;
> -	set_capacity(disk, size >> 9);
> -
> -	disk->flags |= GENHD_FL_EXT_DEVT | GENHD_FL_SUPPRESS_PARTITION_INFO;
> -	disk->major		= null_major;
> -	disk->first_minor	= nullb->index;
> -	disk->fops		= &null_fops;
> -	disk->private_data	= nullb;
> -	disk->queue		= nullb->q;
> -	strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
> -
> -	add_disk(disk);
> -done:
>  	return 0;
>  
> -out_cleanup_lightnvm:
> -	if (use_lightnvm)
> -		nvm_unregister(nullb->disk_name);
>  out_cleanup_blk_list:
>  	mutex_lock(&lock);
>  	list_del_init(&nullb->list);
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2015-12-14 11:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 13:26 [PATCH 1/2] null_blk: Remove null block from list in error path Minfei Huang
2015-11-27 13:26 ` [PATCH 2/2] null_blk: Do a cleanup for function null_add_dev Minfei Huang
2015-12-14 11:43   ` Minfei Huang [this message]
2015-12-09  5:21 ` [PATCH 1/2] null_blk: Remove null block from list in error path Minfei Huang
2015-12-09  8:14   ` Matias Bjørling

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=20151214114335.GA21529@dhcp-128-25.nay.redhat.com \
    --to=mhuang@redhat.com \
    --cc=akinobu.mita@gmail.com \
    --cc=axboe@fb.com \
    --cc=keith.busch@intel.com \
    --cc=krinkin.m.u@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m@bjorling.me \
    --cc=mcgrof@suse.com \
    --cc=mnfhuang@gmail.com \
    --cc=rusty@rustcorp.com.au \
    /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®