Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id 786A1420BCB for ; Sun, 23 May 2021 18:20:45 +0200 (CEST) To: Christoph Hellwig , Jens Axboe , Geert Uytterhoeven , Chris Zankel , Max Filippov , Philipp Reisner , Lars Ellenberg , Jim Paris , Joshua Morris , Philip Kelleher , Minchan Kim , Nitin Gupta , Matias Bjorling , Mike Snitzer , Song Liu , Maxim Levitsky , Alex Dubov , Ulf Hansson , Dan Williams , Vishal Verma , Dave Jiang , Heiko Carstens , Vasily Gorbik , Christian Borntraeger References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-13-hch@lst.de> From: Coly Li Message-ID: <19e05358-abc2-a577-d3bd-d4ae89f6316e@suse.de> Date: Mon, 24 May 2021 00:20:34 +0800 MIME-Version: 1.0 In-Reply-To: <20210521055116.1053587-13-hch@lst.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Cc: linux-bcache@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-mmc@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, linuxppc-dev@lists.ozlabs.org, drbd-dev@lists.linbit.com Subject: Re: [Drbd-dev] [PATCH 12/26] bcache: convert to blk_alloc_disk/blk_cleanup_disk List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 5/21/21 1:51 PM, Christoph Hellwig wrote: > Convert the bcache driver to use the blk_alloc_disk and blk_cleanup_disk > helpers to simplify gendisk and request_queue allocation. > > Signed-off-by: Christoph Hellwig Acked-by: Coly Li Thanks. Coly Li > --- > drivers/md/bcache/super.c | 15 ++++----------- > 1 file changed, 4 insertions(+), 11 deletions(-) > > diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > index bea8c4429ae8..185246a0d855 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -890,13 +890,9 @@ static void bcache_device_free(struct bcache_device *d) > if (disk_added) > del_gendisk(disk); > > - if (disk->queue) > - blk_cleanup_queue(disk->queue); > - > + blk_cleanup_disk(disk); > ida_simple_remove(&bcache_device_idx, > first_minor_to_idx(disk->first_minor)); > - if (disk_added) > - put_disk(disk); > } > > bioset_exit(&d->bio_split); > @@ -946,7 +942,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, > BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER)) > goto err; > > - d->disk = alloc_disk(BCACHE_MINORS); > + d->disk = blk_alloc_disk(NUMA_NO_NODE); > if (!d->disk) > goto err; > > @@ -955,14 +951,11 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, > > d->disk->major = bcache_major; > d->disk->first_minor = idx_to_first_minor(idx); > + d->disk->minors = BCACHE_MINORS; > d->disk->fops = ops; > d->disk->private_data = d; > > - q = blk_alloc_queue(NUMA_NO_NODE); > - if (!q) > - return -ENOMEM; > - > - d->disk->queue = q; > + q = d->disk->queue; > q->limits.max_hw_sectors = UINT_MAX; > q->limits.max_sectors = UINT_MAX; > q->limits.max_segment_size = UINT_MAX; >