Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp456868rwb; Wed, 9 Nov 2022 04:56:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5cACav0+oSoGt3G8rCAdh6eAj5X27rPVD5F/4p1KqR93ESx8WlmwvNBP55hKMFwsWVOdPL X-Received: by 2002:a17:906:3b89:b0:7ae:70a8:6f5e with SMTP id u9-20020a1709063b8900b007ae70a86f5emr11347836ejf.598.1667998577169; Wed, 09 Nov 2022 04:56:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667998577; cv=none; d=google.com; s=arc-20160816; b=GDy0SbYja1U4S09UO8GlVE+7at4atOZODjvp73c1MN0FqcSoCGamfB60LzICs1vH4u Q6L075nQBQ5sRJsyocJsC/9I/u1jG8uD60T5IzIppaF7wwTN+3fpcHzz+uWeRsrMnVKu q7VN69atPuxGKXcrPJBqDVt71b74hI6YCrgwMt9SjyOzoxVac7EijphBIMTQvzqg604G 8mvTgcWBSw4H+7dQHorUsVJn9qOvFy46cawd8TUf0q0dLDqQEgKgpxf9fBwpJPL81QZX znU6IiJw80Saz2tGzaY3VlFGh9Dp6HHgOMrfMKVYvyr0PVJ8oh1P3e83D4WNFn3jj08P 0xdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=CP5HR4/fW62hCUEuUWY+rJW5C3z5hPsLxg/D74tYsWg=; b=Cf+RGQN5m0ddELcyn7Qw6uK5uqK4bmc1F3mREcjeTX3cqXlYcaqvdlVKyhNkreDMRx WdJg1iJuHr5Tc1my4DUjKazpyCrFY19tA83Lnum17BD16n3jUQsz3nkhlhTvYR2gQ8t+ dXhsp2JRwp02givs6EvVj10ZDLfe1PIu/a/OLzwu0rTl+5BIXFdf8EIuee9haCT8GpXe uPDIzbV2G6in8SZUGNUFyfwPx6fQvnZSAsrfIQzA1xRZkGD+yDwmbOQ8Ucdz8tPKGEmK 2fsN3/hzdxP93eDtjd2rKToKuHUCnLCcOOKB0zx6H/KwLRgO41Bw2/fR366lPuKE+tcN VZzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=IQaY+i8K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm20-20020a170907949400b00783b75ec298si15649613ejc.395.2022.11.09.04.55.54; Wed, 09 Nov 2022 04:56:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=IQaY+i8K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230138AbiKIMpg (ORCPT + 93 others); Wed, 9 Nov 2022 07:45:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiKIMpe (ORCPT ); Wed, 9 Nov 2022 07:45:34 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EE20220C3; Wed, 9 Nov 2022 04:45:32 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 547C91BF207; Wed, 9 Nov 2022 12:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1667997930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CP5HR4/fW62hCUEuUWY+rJW5C3z5hPsLxg/D74tYsWg=; b=IQaY+i8KKGP7I+eJmahCk+nqdTj3vEIF7eoLt1ZRFZKkeRIwcVnF3JnaYCeSduXrh/bn6K w4UJf6oLc0ToqR/TsdchrX3M87LJsUqeVpdoxX/b79NlYnEFeN6ylERltWBiWFq4sbUpak H8DsZA7e/bBadHXaNogTXrMlnkYbI8auXlcKSTclxaGcbzlpqA3kbgP1jk6OFS2sF/+Ruw RyGNOg3Xhy3LmartbIq7ojm3aDQo3BOkBLEqXSSASDpJRMM27TPM17VWxqDgSEr/5bJsXa qvpXB2QjMXjsCSARHkY6FP5r6BgvzSrjHtzsSefQRXiFwqY2zMeUNO6XAQCfSQ== Date: Wed, 9 Nov 2022 13:45:26 +0100 From: Miquel Raynal To: Daniel Golle Cc: Jens Axboe , Richard Weinberger , Vignesh Raghavendra , Davidlohr Bueso , Matthew Wilcox , "Martin K. Petersen" , Chaitanya Kulkarni , Ming Lei , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-efi@vger.kernel.org Subject: Re: [PATCH v4 4/5] mtd_blkdevs: add option to enable scanning for partitions Message-ID: <20221109134526.158047e1@xps-13> In-Reply-To: References: Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, daniel@makrotopia.org wrote on Tue, 8 Nov 2022 23:04:13 +0000: > Add Kconfig boolean CONFIG_MTD_BLOCK_PARTITIONS and enable block > partition parsers on non-NAND mtdblock devices in case it is selected. >=20 > Signed-off-by: Daniel Golle > Acked-by: Miquel Raynal > --- > drivers/mtd/Kconfig | 11 +++++++++++ > drivers/mtd/mtd_blkdevs.c | 4 +++- > 2 files changed, 14 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig > index 796a2eccbef0..12874dec1569 100644 > --- a/drivers/mtd/Kconfig > +++ b/drivers/mtd/Kconfig > @@ -69,6 +69,17 @@ config MTD_BLOCK_RO > You do not need this option for use with the DiskOnChip devices. For > those, enable NFTL support (CONFIG_NFTL) instead. > =20 > +config MTD_BLOCK_PARTITIONS > + bool "Scan for partitions on MTD block devices" > + depends on MTD_BLOCK || MTD_BLOCK_RO > + default y if FIT_PARTITION > + help > + Scan MTD block devices for partitions (ie. MBR, GPT, uImage.FIT, ...). > + (NAND devices are omitted, ubiblock should be used instead when) > + > + Unless your MTD partitions contain sub-partitions mapped using a > + partition table, say no. Actually I know I've acked this patch in the past but I am now wondering again if this is the right way so I would like to discuss this again. I don't feel making partitions on top of blk devices like that is the right solution. Why not using the advanced partition parsers that we now have in MTD to create these subpartitions and then have blocks emulated on top of them? > + > comment "Note that in some cases UBI block is preferred. See MTD_UBI_BLO= CK." > depends on MTD_BLOCK || MTD_BLOCK_RO > =20 > diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c > index 60b222799871..e6f2e0888246 100644 > --- a/drivers/mtd/mtd_blkdevs.c > +++ b/drivers/mtd/mtd_blkdevs.c > @@ -359,7 +359,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new) > } else { > snprintf(gd->disk_name, sizeof(gd->disk_name), > "%s%d", tr->name, new->devnum); > - gd->flags |=3D GENHD_FL_NO_PART; > + > + if (!IS_ENABLED(CONFIG_MTD_BLOCK_PARTITIONS) || mtd_type_is_nand(new->= mtd)) > + gd->flags |=3D GENHD_FL_NO_PART; > } > =20 > set_capacity(gd, ((u64)new->size * tr->blksize) >> 9); Thanks, Miqu=C3=A8l