From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9027A70 for ; Fri, 21 May 2021 17:16:49 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id t9so2882418ply.6 for ; Fri, 21 May 2021 10:16:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/6CTfoP+3YhIDA2Sa2Vg3MwIl/4IQc5OvLMHtpk2uwk=; b=YtS+x1sl0oFOxNsEeWNfG8Axl0D5hvJWCpOQ+VQT64cEBaN5pXtMW43kfTZcVo9mza vEwzxyQy+aKcU1Lo5rPDlGvRUqQ4g+t11bS4RSo0C19BZgfrujKAldg291ZiXBcvhCm1 HolSNXlbHfXXMG+QUoAtg1wsaeUR49MCR2a+x0Rz6u6UrXRNmg7JEH003fv19zZQMiKq z5tPAmUXhS87XwMnUqkrKUNyMf/aSrEzB98XR8wDKZapQxzs8XZCiIQdlG3ehYcGWMNA myT/GDEdrG3NyT2D1jGHgFapBuOyuFj8md0IOAcSCodPVVpF6nFRxzd6JF8Ns2eqIAVi wqSQ== X-Gm-Message-State: AOAM530tefmevSKNmjdOxs6JlvQzHXv4eBJfAVSmA8mdVTMXm/hynUXR NISMfLJtqB0UHW+A2TcjxTA= X-Google-Smtp-Source: ABdhPJxtynqdEQ1F/D+2PqiHL9NmQC5jqLXgWhG+E7yzr8uLp59ObRLAPQ67LxwzZAhslkMqhOa4cA== X-Received: by 2002:a17:90a:590d:: with SMTP id k13mr12082927pji.68.1621617409049; Fri, 21 May 2021 10:16:49 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id q24sm4964064pgb.19.2021.05.21.10.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:16:47 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 6461E423A3; Fri, 21 May 2021 17:16:46 +0000 (UTC) Date: Fri, 21 May 2021 17:16:46 +0000 From: Luis Chamberlain To: Christoph Hellwig Cc: 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: <20210521171646.GA25017@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> 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: <20210521055116.1053587-2-hch@lst.de> On Fri, May 21, 2021 at 07:50:51AM +0200, Christoph Hellwig wrote: > diff --git a/block/genhd.c b/block/genhd.c > index 39ca97b0edc6..2c00bc3261d9 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -335,52 +335,22 @@ static int blk_mangle_minor(int minor) <-- snip --> > -int blk_alloc_devt(struct block_device *bdev, dev_t *devt) > +int blk_alloc_ext_minor(void) > { > - struct gendisk *disk = bdev->bd_disk; > int idx; > > - /* 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. Other than that, this looks like a super nice cleanup! Reviewed-by: Luis Chamberlain Luis 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=-14.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 C9A27C04FF3 for ; Mon, 24 May 2021 19:45:28 +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 87E656109F for ; Mon, 24 May 2021 19:45:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87E656109F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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=hsxNCYPvqyNzkwxCODJR3B1UIIXXzrlaaBVgPVh9CsY=; b=GwLhL9CY/72xOa cKssp6xEbtj6eh2jVk89tglYxtAQGsHWIDoDAgXi+yKzQhscUbaSY+IVy2p/ZmSfsP6iczgp5txoy LV3YfxYTaZqzRHPgT1BTSWMWdJeeY7Zm47psTgecIBit/47m6v/0ftRBVev/EPIO+s3lwe1XYR1NQ 0RBzpmOvse1wpVNGLg1itQ+4Nb1pyPURB6epcusvTxmDegR1GF85SueAfvHH9OwV53ALBMdMQkacv ETwOBiw30uEPIuBANSJIttuESKz+DZOMGVTdrQgaASbHEyNxAAnKiDOY/leFKPpix9D1QtjVPHfAp bvdzmek8zbXhpoAKGb6w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1llGVg-001jEF-Ek; Mon, 24 May 2021 19:45:08 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lk8lZ-000RnV-VZ for linux-nvme@desiato.infradead.org; Fri, 21 May 2021 17:16:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=/6CTfoP+3YhIDA2Sa2Vg3MwIl/4IQc5OvLMHtpk2uwk=; b=z6r1sqT8rwLEzzenuMsHBkDjKp Sto1uHT2bGbNoUkGbI9JibG/CfNbxUaIkkbMRNJYM8/vhvNERanZimxoiGp9XpxvtV4IqfunlTKo5 qLjrZBxE20meRFoIbDI2MjjjPIDHM10nLDEVAE/7Yh4tWZ39fWJBL9TuxvFbtlLmBzFD40iNVlgDd j+XdXwQR/c+e6fsVHHjSKakYF0bZbFs1yqLaXlMwCBgmJEnQXwRUNwLCGsjc8P+tAN2P6YppcL1X2 WuKsrzfPIdUkbhbn1mEiIBLNNhZluqlpyoMjctToO3tRCq55l6jItFd03XGiRVBQ7CBLj55mMh4dO jqlMAPdw==; Received: from mail-pl1-f171.google.com ([209.85.214.171]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lk8lW-00HItC-WE for linux-nvme@lists.infradead.org; Fri, 21 May 2021 17:16:52 +0000 Received: by mail-pl1-f171.google.com with SMTP id s20so11318315plr.13 for ; Fri, 21 May 2021 10:16:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/6CTfoP+3YhIDA2Sa2Vg3MwIl/4IQc5OvLMHtpk2uwk=; b=TXCKCfk7ww+feOGgwxRlUhHQEEuBK4A5yzF+JdYZt+EBsKE+TeUnsOcXFQJYE7kT3e NW0IA0MNUHSatMKoTSbTYLsCbPsRUh/r4ZWhihlvTYYthWoIM2uPAHNrv+huHQ0i/vK6 fHq8ien7Av0CBVIhHdt024eahV7q4UaAKE7UvV5UuRS2lB0WcnmZDtYLYWo/iXNzFX+u iWI7oAhMmKy5kdEwFg3AbAoREm4k/nlIREW6uQn94HXha1rRmNm1FOUYjB8rhGTWdkIT 9U/Ei904yEt6GJs0ZSIx1/NvHu+pPmBtNIuGgFW8t3hmUqXCoeoE1uO+W6mkuSCuiQd/ mUWQ== X-Gm-Message-State: AOAM530NQUWT80zujaEaQYdTNB7LlJxCaYMvfHKihbZCeGMjiZMrOSsg PC9W/gEDyM3AsvPUNawu08I= X-Google-Smtp-Source: ABdhPJxtynqdEQ1F/D+2PqiHL9NmQC5jqLXgWhG+E7yzr8uLp59ObRLAPQ67LxwzZAhslkMqhOa4cA== X-Received: by 2002:a17:90a:590d:: with SMTP id k13mr12082927pji.68.1621617409049; Fri, 21 May 2021 10:16:49 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id q24sm4964064pgb.19.2021.05.21.10.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:16:47 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 6461E423A3; Fri, 21 May 2021 17:16:46 +0000 (UTC) Date: Fri, 21 May 2021 17:16:46 +0000 From: Luis Chamberlain To: Christoph Hellwig Cc: 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: <20210521171646.GA25017@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210521055116.1053587-2-hch@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210521_101651_056321_D86EC750 X-CRM114-Status: GOOD ( 20.05 ) 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 07:50:51AM +0200, Christoph Hellwig wrote: > diff --git a/block/genhd.c b/block/genhd.c > index 39ca97b0edc6..2c00bc3261d9 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -335,52 +335,22 @@ static int blk_mangle_minor(int minor) <-- snip --> > -int blk_alloc_devt(struct block_device *bdev, dev_t *devt) > +int blk_alloc_ext_minor(void) > { > - struct gendisk *disk = bdev->bd_disk; > int idx; > > - /* 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. Other than that, this looks like a super nice cleanup! Reviewed-by: Luis Chamberlain Luis _______________________________________________ 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=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 4E83BC47076 for ; Fri, 21 May 2021 17:17:16 +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 D4C3461175 for ; Fri, 21 May 2021 17:17:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4C3461175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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 4FmtZf1lLjz3btr for ; Sat, 22 May 2021 03:17:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=209.85.214.175; helo=mail-pl1-f175.google.com; envelope-from=mcgrof@gmail.com; receiver=) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FmtZD0JP7z305w for ; Sat, 22 May 2021 03:16:51 +1000 (AEST) Received: by mail-pl1-f175.google.com with SMTP id a7so2635538plh.3 for ; Fri, 21 May 2021 10:16:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/6CTfoP+3YhIDA2Sa2Vg3MwIl/4IQc5OvLMHtpk2uwk=; b=Dcobzb8r3xHq1GkoKEJI3GQaIlA8y/JNd4QquHPoD+qmDN8c85GugbIac+VLd3xbtC i0p6uQ9Cj3yEH5m3d1bgmKPTbR1EiHVRj67lypMYqQhsF9E5GRqEqJk+PG5J+c3ypNfZ e9uSmzazvfews7x19x1SJO/0fPYLSi1/IMQH6WdYiUZioLIeXlobi4kbmIUonkHNpt9J W9K/VtsPqutApcFVu5yo71Mb9YeCjsY68nJ6XgOpElOH9zrZc/Sxy1J2vwGvDIVaKpdS wRad0Hf+/xcHiK0nbE8ojrvYZWCW9d20rHE5z4Gm94lQsONOltLA0IqX6rl5ixrJ6xJd oGxg== X-Gm-Message-State: AOAM533asTLusLfpkoamX+NHqEQdU023U/wr3u3oKFRoqdjCz1QbaDqE x6t4PzPAWZ/EsN2CE9gcrTg= X-Google-Smtp-Source: ABdhPJxtynqdEQ1F/D+2PqiHL9NmQC5jqLXgWhG+E7yzr8uLp59ObRLAPQ67LxwzZAhslkMqhOa4cA== X-Received: by 2002:a17:90a:590d:: with SMTP id k13mr12082927pji.68.1621617409049; Fri, 21 May 2021 10:16:49 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id q24sm4964064pgb.19.2021.05.21.10.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:16:47 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 6461E423A3; Fri, 21 May 2021 17:16:46 +0000 (UTC) Date: Fri, 21 May 2021 17:16:46 +0000 From: Luis Chamberlain To: Christoph Hellwig Subject: Re: [dm-devel] [PATCH 01/26] block: refactor device number setup in __device_add_disk Message-ID: <20210521171646.GA25017@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521055116.1053587-2-hch@lst.de> 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 , 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 07:50:51AM +0200, Christoph Hellwig wrote: > diff --git a/block/genhd.c b/block/genhd.c > index 39ca97b0edc6..2c00bc3261d9 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -335,52 +335,22 @@ static int blk_mangle_minor(int minor) <-- snip --> > -int blk_alloc_devt(struct block_device *bdev, dev_t *devt) > +int blk_alloc_ext_minor(void) > { > - struct gendisk *disk = bdev->bd_disk; > int idx; > > - /* 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. Other than that, this looks like a super nice cleanup! Reviewed-by: Luis Chamberlain Luis 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=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 5D452C04FF3 for ; Mon, 24 May 2021 06:47:50 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 CD36A600EF for ; Mon, 24 May 2021 06:47:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD36A600EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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-102-1SAOm1xGPYiufvY5UXY96Q-1; Mon, 24 May 2021 02:47:47 -0400 X-MC-Unique: 1SAOm1xGPYiufvY5UXY96Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD774501E3; Mon, 24 May 2021 06:47:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F1F31002EF0; Mon, 24 May 2021 06:47:42 +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 75B885534D; Mon, 24 May 2021 06:47:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14LHH0bo023117 for ; Fri, 21 May 2021 13:17:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 528551692BE; Fri, 21 May 2021 17:17:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AF3B16C2C6 for ; Fri, 21 May 2021 17:16:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 2B48B182506A for ; Fri, 21 May 2021 17:16:57 +0000 (UTC) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-avu8VYVRPVCpVo666IPC8w-1; Fri, 21 May 2021 13:16:50 -0400 X-MC-Unique: avu8VYVRPVCpVo666IPC8w-1 Received: by mail-pl1-f181.google.com with SMTP id s4so9769038plg.12; Fri, 21 May 2021 10:16:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/6CTfoP+3YhIDA2Sa2Vg3MwIl/4IQc5OvLMHtpk2uwk=; b=fn3UZ0zwz7vXYqVp2ZAJ5GMxpSun6cWAvx1urg7r+77dkihdy4MD8rV2fBwI25y2J8 iJcpJG2v8zL/h7CU8hTL0pRZSVeehzje87It2GaxAOf6KHHmPgDfBPZJP7rPExt/8oke NoK6y/yhRn7rqBL9jYJ8yhZJpnnXi25dlC/AwlgCfqjPFpa+PVYDZ9Yr3Rmz4T+twApW tN4B7ut4vO3jkhR013CohlPKSfsCyxBA1reoaCiokUA7o0Z7pEIT9+OgHKXtRbKo7otj B2NP5HYFPbMJnjV8hZevT0NyNi1cYnbU35MbW6TygLYTXI3L5akVWku5gT4+kzgawKgY xRig== X-Gm-Message-State: AOAM533bzC9Cb69d93Caj1sIVQFXgW1BFGxUWdjtTf5Dyr9/Btyuc8Cp yE/nkYMyNQwVMu/PZ/KjHgo= X-Google-Smtp-Source: ABdhPJxtynqdEQ1F/D+2PqiHL9NmQC5jqLXgWhG+E7yzr8uLp59ObRLAPQ67LxwzZAhslkMqhOa4cA== X-Received: by 2002:a17:90a:590d:: with SMTP id k13mr12082927pji.68.1621617409049; Fri, 21 May 2021 10:16:49 -0700 (PDT) Received: from 42.do-not-panic.com (42.do-not-panic.com. [157.230.128.187]) by smtp.gmail.com with ESMTPSA id q24sm4964064pgb.19.2021.05.21.10.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 May 2021 10:16:47 -0700 (PDT) Received: by 42.do-not-panic.com (Postfix, from userid 1000) id 6461E423A3; Fri, 21 May 2021 17:16:46 +0000 (UTC) Date: Fri, 21 May 2021 17:16:46 +0000 From: Luis Chamberlain To: Christoph Hellwig Message-ID: <20210521171646.GA25017@42.do-not-panic.com> References: <20210521055116.1053587-1-hch@lst.de> <20210521055116.1053587-2-hch@lst.de> MIME-Version: 1.0 In-Reply-To: <20210521055116.1053587-2-hch@lst.de> 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.79 on 10.11.54.5 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 24 May 2021 02:47:09 -0400 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 , 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.22 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 07:50:51AM +0200, Christoph Hellwig wrote: > diff --git a/block/genhd.c b/block/genhd.c > index 39ca97b0edc6..2c00bc3261d9 100644 > --- a/block/genhd.c > +++ b/block/genhd.c > @@ -335,52 +335,22 @@ static int blk_mangle_minor(int minor) <-- snip --> > -int blk_alloc_devt(struct block_device *bdev, dev_t *devt) > +int blk_alloc_ext_minor(void) > { > - struct gendisk *disk = bdev->bd_disk; > int idx; > > - /* 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. Other than that, this looks like a super nice cleanup! Reviewed-by: Luis Chamberlain Luis -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel