From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9490817F for ; Mon, 24 May 2021 07:20:23 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id A686B67373; Mon, 24 May 2021 09:20:13 +0200 (CEST) Date: Mon, 24 May 2021 09:20:13 +0200 From: Christoph Hellwig To: Luis Chamberlain Cc: 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 , Coly Li , Mike Snitzer , Song Liu , Maxim Levitsky , Alex Dubov , Ulf Hansson , Dan Williams , Vishal Verma , Dave Jiang , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-xtensa@linux-xtensa.org, linux-m68k@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-mmc@vger.kernel.org, linux-bcache@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, drbd-dev@tron.linbit.com, linuxppc-dev@lists.ozlabs.org Subject: Re: [dm-devel] [PATCH 01/26] block: refactor device number setup in __device_add_disk Message-ID: <20210524072013.GA23890@lst.de> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> <20210521171646.GA25017@42.do-not-panic.com> X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521171646.GA25017@42.do-not-panic.com> User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, May 21, 2021 at 05:16:46PM +0000, Luis Chamberlain wrote: > > - /* in consecutive minor range? */ > > - if (bdev->bd_partno < disk->minors) { > > - *devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > - return 0; > > - } > > - > > It is not obviously clear to me, why this was part of add_disk() > path, and ... > > > diff --git a/block/partitions/core.c b/block/partitions/core.c > > index dc60ecf46fe6..504297bdc8bf 100644 > > --- a/block/partitions/core.c > > +++ b/block/partitions/core.c > > @@ -379,9 +380,15 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, > > pdev->type = &part_type; > > pdev->parent = ddev; > > > > - err = blk_alloc_devt(bdev, &devt); > > - if (err) > > - goto out_put; > > + /* in consecutive minor range? */ > > + if (bdev->bd_partno < disk->minors) { > > + devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > + } else { > > + err = blk_alloc_ext_minor(); > > + if (err < 0) > > + goto out_put; > > + devt = MKDEV(BLOCK_EXT_MAJOR, err); > > + } > > pdev->devt = devt; > > > > /* delay uevent until 'holders' subdir is created */ > > ... and why we only add this here now. For the genhd minors == 0 (aka GENHD_FL_EXT_DEVT) implies having to allocate a dynamic dev_t, so it can be folded into another conditional. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F219C2B9F7 for ; Mon, 24 May 2021 23:02:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCDDD6138C for ; Mon, 24 May 2021 23:02:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCDDD6138C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h6yERHPv07Ii2kdGM8qBy+CKKdVcvnnxYjJpLipusH0=; b=WV2qNvQSOs8fW6 wWA065QjNdBooCc77xf6eydiAtA0lXTzZ/YEb/CEUWBUm2nJhg3g92RGHVsUrH2R5bA9DN4EnuxPY 3FBByChHdGcHmBZKZxOup6Pu+A4wbUr5kZGTvfdihuI0qdfp8Ouuxw54Wis5siK5FQx0BpK5EWaJ/ TeApuw1Wd7ucoAzV/bz6kpEz72hAEsEBqkwexYwwgDsRkKPU7rFbvxkBZsTrUjy7vU+2ZzaQBj+k5 955V6U3/U3YTASfq/QGpPHhosEOjYt6uQtR9SbwaI9YT/5sFD4tsvgxx6YONXrd0qHyfpWLMZZzn9 JziJdw4zpPBWY2X+FZ4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1llJa0-002Fyw-C5; Mon, 24 May 2021 23:01:48 +0000 Received: from verein.lst.de ([213.95.11.211]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ll4sw-000jrz-JP for linux-nvme@lists.infradead.org; Mon, 24 May 2021 07:20:24 +0000 Received: by verein.lst.de (Postfix, from userid 2407) id A686B67373; Mon, 24 May 2021 09:20:13 +0200 (CEST) Date: Mon, 24 May 2021 09:20:13 +0200 From: Christoph Hellwig To: Luis Chamberlain Cc: 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 , Coly Li , Mike Snitzer , Song Liu , Maxim Levitsky , Alex Dubov , Ulf Hansson , Dan Williams , Vishal Verma , Dave Jiang , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-xtensa@linux-xtensa.org, linux-m68k@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-mmc@vger.kernel.org, linux-bcache@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, dm-devel@redhat.com, drbd-dev@tron.linbit.com, linuxppc-dev@lists.ozlabs.org Subject: Re: [dm-devel] [PATCH 01/26] block: refactor device number setup in __device_add_disk Message-ID: <20210524072013.GA23890@lst.de> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> <20210521171646.GA25017@42.do-not-panic.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210521171646.GA25017@42.do-not-panic.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210524_002022_828101_AA1F215A X-CRM114-Status: GOOD ( 21.12 ) X-Mailman-Approved-At: Mon, 24 May 2021 11:59:45 -0700 X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Fri, May 21, 2021 at 05:16:46PM +0000, Luis Chamberlain wrote: > > - /* in consecutive minor range? */ > > - if (bdev->bd_partno < disk->minors) { > > - *devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > - return 0; > > - } > > - > > It is not obviously clear to me, why this was part of add_disk() > path, and ... > > > diff --git a/block/partitions/core.c b/block/partitions/core.c > > index dc60ecf46fe6..504297bdc8bf 100644 > > --- a/block/partitions/core.c > > +++ b/block/partitions/core.c > > @@ -379,9 +380,15 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, > > pdev->type = &part_type; > > pdev->parent = ddev; > > > > - err = blk_alloc_devt(bdev, &devt); > > - if (err) > > - goto out_put; > > + /* in consecutive minor range? */ > > + if (bdev->bd_partno < disk->minors) { > > + devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > + } else { > > + err = blk_alloc_ext_minor(); > > + if (err < 0) > > + goto out_put; > > + devt = MKDEV(BLOCK_EXT_MAJOR, err); > > + } > > pdev->devt = devt; > > > > /* delay uevent until 'holders' subdir is created */ > > ... and why we only add this here now. For the genhd minors == 0 (aka GENHD_FL_EXT_DEVT) implies having to allocate a dynamic dev_t, so it can be folded into another conditional. _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2E2FC04FF3 for ; Mon, 24 May 2021 07:20:47 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31C17610CE for ; Mon, 24 May 2021 07:20:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31C17610CE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FpTC145Xyz3bsH for ; Mon, 24 May 2021 17:20:45 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lst.de (client-ip=213.95.11.211; helo=verein.lst.de; envelope-from=hch@lst.de; receiver=) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FpTBb1sBXz2xYg for ; Mon, 24 May 2021 17:20:22 +1000 (AEST) Received: by verein.lst.de (Postfix, from userid 2407) id A686B67373; Mon, 24 May 2021 09:20:13 +0200 (CEST) Date: Mon, 24 May 2021 09:20:13 +0200 From: Christoph Hellwig To: Luis Chamberlain Subject: Re: [dm-devel] [PATCH 01/26] block: refactor device number setup in __device_add_disk Message-ID: <20210524072013.GA23890@lst.de> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> <20210521171646.GA25017@42.do-not-panic.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521171646.GA25017@42.do-not-panic.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nvdimm@lists.linux.dev, Ulf Hansson , Mike Snitzer , linux-m68k@vger.kernel.org, linux-nvme@lists.infradead.org, Song Liu , dm-devel@redhat.com, Joshua Morris , linux-s390@vger.kernel.org, Dave Jiang , Maxim Levitsky , Vishal Verma , Christoph Hellwig , Christian Borntraeger , Geert Uytterhoeven , Matias Bjorling , Nitin Gupta , Vasily Gorbik , linux-xtensa@linux-xtensa.org, Alex Dubov , Heiko Carstens , Coly Li , linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, drbd-dev@tron.linbit.com, Philip Kelleher , Dan Williams , Jens Axboe , Chris Zankel , Max Filippov , linux-mmc@vger.kernel.org, Philipp Reisner , Jim Paris , Minchan Kim , Lars Ellenberg , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, May 21, 2021 at 05:16:46PM +0000, Luis Chamberlain wrote: > > - /* in consecutive minor range? */ > > - if (bdev->bd_partno < disk->minors) { > > - *devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > - return 0; > > - } > > - > > It is not obviously clear to me, why this was part of add_disk() > path, and ... > > > diff --git a/block/partitions/core.c b/block/partitions/core.c > > index dc60ecf46fe6..504297bdc8bf 100644 > > --- a/block/partitions/core.c > > +++ b/block/partitions/core.c > > @@ -379,9 +380,15 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, > > pdev->type = &part_type; > > pdev->parent = ddev; > > > > - err = blk_alloc_devt(bdev, &devt); > > - if (err) > > - goto out_put; > > + /* in consecutive minor range? */ > > + if (bdev->bd_partno < disk->minors) { > > + devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > + } else { > > + err = blk_alloc_ext_minor(); > > + if (err < 0) > > + goto out_put; > > + devt = MKDEV(BLOCK_EXT_MAJOR, err); > > + } > > pdev->devt = devt; > > > > /* delay uevent until 'holders' subdir is created */ > > ... and why we only add this here now. For the genhd minors == 0 (aka GENHD_FL_EXT_DEVT) implies having to allocate a dynamic dev_t, so it can be folded into another conditional. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58450C04FF3 for ; Mon, 24 May 2021 07:20:45 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B108061151 for ; Mon, 24 May 2021 07:20:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B108061151 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=dm-devel-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-79-PJYTgYUJNsGeK1WDOJpRAA-1; Mon, 24 May 2021 03:20:40 -0400 X-MC-Unique: PJYTgYUJNsGeK1WDOJpRAA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 553E71013739; Mon, 24 May 2021 07:20:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14B2EE156; Mon, 24 May 2021 07:20:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9F41B1801029; Mon, 24 May 2021 07:20:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14O7KNxF011390 for ; Mon, 24 May 2021 03:20:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id DCDBA2157FA4; Mon, 24 May 2021 07:20:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D8B312157FA3 for ; Mon, 24 May 2021 07:20:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3827E83395E for ; Mon, 24 May 2021 07:20:21 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-JS4TfxtlOJCUshspfVaR3A-1; Mon, 24 May 2021 03:20:18 -0400 X-MC-Unique: JS4TfxtlOJCUshspfVaR3A-1 Received: by verein.lst.de (Postfix, from userid 2407) id A686B67373; Mon, 24 May 2021 09:20:13 +0200 (CEST) Date: Mon, 24 May 2021 09:20:13 +0200 From: Christoph Hellwig To: Luis Chamberlain Message-ID: <20210524072013.GA23890@lst.de> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> <20210521171646.GA25017@42.do-not-panic.com> MIME-Version: 1.0 In-Reply-To: <20210521171646.GA25017@42.do-not-panic.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: dm-devel@redhat.com Cc: nvdimm@lists.linux.dev, Ulf Hansson , Mike Snitzer , linux-m68k@vger.kernel.org, linux-nvme@lists.infradead.org, Song Liu , dm-devel@redhat.com, Joshua Morris , linux-s390@vger.kernel.org, Dave Jiang , Maxim Levitsky , Vishal Verma , Christoph Hellwig , Christian Borntraeger , Geert Uytterhoeven , Matias Bjorling , Nitin Gupta , Vasily Gorbik , linux-xtensa@linux-xtensa.org, Alex Dubov , Heiko Carstens , Coly Li , linux-raid@vger.kernel.org, linux-bcache@vger.kernel.org, linux-block@vger.kernel.org, drbd-dev@tron.linbit.com, Philip Kelleher , Dan Williams , Jens Axboe , Chris Zankel , Max Filippov , linux-mmc@vger.kernel.org, Philipp Reisner , Jim Paris , Minchan Kim , Lars Ellenberg , linuxppc-dev@lists.ozlabs.org Subject: Re: [dm-devel] [PATCH 01/26] block: refactor device number setup in __device_add_disk X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, May 21, 2021 at 05:16:46PM +0000, Luis Chamberlain wrote: > > - /* in consecutive minor range? */ > > - if (bdev->bd_partno < disk->minors) { > > - *devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > - return 0; > > - } > > - > > It is not obviously clear to me, why this was part of add_disk() > path, and ... > > > diff --git a/block/partitions/core.c b/block/partitions/core.c > > index dc60ecf46fe6..504297bdc8bf 100644 > > --- a/block/partitions/core.c > > +++ b/block/partitions/core.c > > @@ -379,9 +380,15 @@ static struct block_device *add_partition(struct gendisk *disk, int partno, > > pdev->type = &part_type; > > pdev->parent = ddev; > > > > - err = blk_alloc_devt(bdev, &devt); > > - if (err) > > - goto out_put; > > + /* in consecutive minor range? */ > > + if (bdev->bd_partno < disk->minors) { > > + devt = MKDEV(disk->major, disk->first_minor + bdev->bd_partno); > > + } else { > > + err = blk_alloc_ext_minor(); > > + if (err < 0) > > + goto out_put; > > + devt = MKDEV(BLOCK_EXT_MAJOR, err); > > + } > > pdev->devt = devt; > > > > /* delay uevent until 'holders' subdir is created */ > > ... and why we only add this here now. For the genhd minors == 0 (aka GENHD_FL_EXT_DEVT) implies having to allocate a dynamic dev_t, so it can be folded into another conditional. -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel