[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221109134526.158047e1@xps-13>
Date: Wed, 9 Nov 2022 13:45:26 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Daniel Golle <daniel@...rotopia.org>
Cc: Jens Axboe <axboe@...nel.dk>, Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Davidlohr Bueso <dave@...olabs.net>,
Matthew Wilcox <willy@...radead.org>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Chaitanya Kulkarni <kch@...dia.com>,
Ming Lei <ming.lei@...hat.com>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-efi@...r.kernel.org
Subject: Re: [PATCH v4 4/5] mtd_blkdevs: add option to enable scanning for
partitions
Hi Daniel,
daniel@...rotopia.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 <daniel@...rotopia.org>
> Acked-by: Miquel Raynal <miquel.raynal@...tlin.com>
> ---
> 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?
> +
> 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
Powered by blists - more mailing lists