Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp494245rwb; Wed, 9 Nov 2022 05:21:53 -0800 (PST) X-Google-Smtp-Source: AMsMyM5ucPgOwHLljk2v33n6ybLdfDKs6IKSAfg9AjFiMfv3vFhuPVH1jmfF3LihTcXovTIZlkOu X-Received: by 2002:a05:6402:1292:b0:463:27a0:72b4 with SMTP id w18-20020a056402129200b0046327a072b4mr55971523edv.419.1668000113550; Wed, 09 Nov 2022 05:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668000113; cv=none; d=google.com; s=arc-20160816; b=uG7Y2m1X9jsix3zLIGb/B5AbJjsg92NjCuLkW5NC4Lt03WPG0mjJNa6DokryznhhPY ZUxJq+fH2OrS1QtRL7RaNLm6I2z8V+kg69iib35D0YXqRM4wNsM4MO35ZmrECr+Jq6B+ uxfB35DfYv++pzYJyXxHjz5jDSA3pcHSC6AqCibM3+KiKl3yODr8ORIdAb7dKiFb38nb mr/ICKNfvtFSMrGNvgrSiUlK/G2mD66EGwAC9R26nwRtbatFB6V30H2yCK14FP+8qCG9 7dyzgnr73ELSafYsXOKjZDzo8RDdLRSopIztBtLJyj+Q8uJ9JSUtytX0EgjMH04HeSLH fUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2sPySJOJcOveC5zJLpkZJ4ygUeOSwsNCD+fAPOMPVD8=; b=EiAfG0qoiKK9rtg2eO7rPfmDUZ+2Z9d7lLBbYo5HkIMy0q3jnTmf6sQ9PtOCI0wqrV d53g+sRwgHypHfHc+XfqYpdUwOWyzrvMsr7W19sktuF3dWTTr/k1Q9LWPyynPtWKDhsX XS3E9lxMkWlS+ySZhHZTFfqYDYk7eRh7sOVy0qrvNzgSmC8g0moGaEPGDZP42sUiKsdI kWHAa9jN/+0izLn1ZPzq8Nq43059dgy2bFBh0YAdEHuntZYa3RWxb4PE7aTbWFDo5JsZ ncj/FIHJsZFoL5QTiK1KrZ9cH/OFj+oclucaaXevcvW8dhlkiY4MMc/kdFBmfObNitOW sV2w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp10-20020a1709073e0a00b0078d85777c4fsi17532348ejc.700.2022.11.09.05.21.30; Wed, 09 Nov 2022 05:21:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbiKINLD (ORCPT + 93 others); Wed, 9 Nov 2022 08:11:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbiKINK4 (ORCPT ); Wed, 9 Nov 2022 08:10:56 -0500 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED8F1B1F1; Wed, 9 Nov 2022 05:10:53 -0800 (PST) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.94.2) (envelope-from ) id 1oskqh-000828-0n; Wed, 09 Nov 2022 14:10:35 +0100 Date: Wed, 9 Nov 2022 13:10:31 +0000 From: Daniel Golle To: Miquel Raynal 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: References: <20221109134526.158047e1@xps-13> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221109134526.158047e1@xps-13> X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,PDS_OTHER_BAD_TLD, SPF_HELO_NONE,SPF_PASS autolearn=no 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 Miquel, On Wed, Nov 09, 2022 at 01:45:26PM +0100, Miquel Raynal wrote: > 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. > > > > 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(-) > > > > 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. > > > > +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? Simply because then we would need the same parser implemented one time as block/partitions/fit.c (for devices booting from SATA or eMMC, for example) and then another time as drivers/mtd/parsers/parse_fit.c (for devices using raw NOR flash) and for UBI there isn't even any infrastructure allowing the dynamic splitting of UBI volumes (hence we would need to invent a new splitting/partitioning mechanism on top of UBI just for that). Using the block partition parser as common ground for all three storage types typically found in embedded devices seemed like the best idea, as in that way I only had to implement the uImage.FIT parser once. > > > + > > comment "Note that in some cases UBI block is preferred. See MTD_UBI_BLOCK." > > depends on MTD_BLOCK || MTD_BLOCK_RO > > > > 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 |= GENHD_FL_NO_PART; > > + > > + if (!IS_ENABLED(CONFIG_MTD_BLOCK_PARTITIONS) || mtd_type_is_nand(new->mtd)) > > + gd->flags |= GENHD_FL_NO_PART; > > } > > > > set_capacity(gd, ((u64)new->size * tr->blksize) >> 9); > > > Thanks, > Miqu?l