From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753971AbdFWIOi (ORCPT ); Fri, 23 Jun 2017 04:14:38 -0400 Received: from server.coly.li ([162.144.45.48]:45220 "EHLO server.coly.li" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753551AbdFWIOg (ORCPT ); Fri, 23 Jun 2017 04:14:36 -0400 X-Greylist: delayed 2658 seconds by postgrey-1.27 at vger.kernel.org; Fri, 23 Jun 2017 04:14:36 EDT Subject: Re: [PATCH] bcache: release the allocated id, not its multiple of BCACHE_MINORS To: Liang Chen Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, colyli@suse.de, bcache@linux.ewheeler.net References: <1498202111-30469-1-git-send-email-liangchen.linux@gmail.com> From: Coly Li Message-ID: Date: Fri, 23 Jun 2017 15:30:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1498202111-30469-1-git-send-email-liangchen.linux@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server.coly.li X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - coly.li X-Get-Message-Sender-Via: server.coly.li: authenticated_id: i@coly.li X-Authenticated-Sender: server.coly.li: i@coly.li X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/6/23 下午3:15, Liang Chen wrote: > The id passed to ida_simple_remove has to be the one originally > allocated with ida_simple_get, not the one after multipling by > BCACHE_MINORS. > > Signed-off-by: Liang Chen > --- > drivers/md/bcache/super.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c > index e57353e..9f64477 100644 > --- a/drivers/md/bcache/super.c > +++ b/drivers/md/bcache/super.c > @@ -734,7 +734,8 @@ static void bcache_device_free(struct bcache_device *d) > if (d->disk && d->disk->queue) > blk_cleanup_queue(d->disk->queue); > if (d->disk) { > - ida_simple_remove(&bcache_minor, d->disk->first_minor); > + ida_simple_remove(&bcache_minor, > + d->disk->first_minor / BCACHE_MINORS); > put_disk(d->disk); > } > > @@ -784,7 +785,7 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, > > if (!(d->bio_split = bioset_create(4, offsetof(struct bbio, bio))) || > !(d->disk = alloc_disk(BCACHE_MINORS))) { > - ida_simple_remove(&bcache_minor, minor); > + ida_simple_remove(&bcache_minor, minor / BCACHE_MINORS); > return -ENOMEM; > } > > Hi Liang, Junhui fixes it already, the patch is submitted to Jens Axboe already. Maybe the patch will show up in next merge window. -- Coly Li