[PATCH] [MTD] BLOCK_RO: Readonly Block Device Layer Over MTD
Josh Boyer
jwboyer at linux.vnet.ibm.com
Mon Nov 20 09:52:44 EST 2006
On Fri, 2006-11-17 at 18:40 +0300, kbaidarov wrote:
> + /* scan for bad block up to where we want */
> + while (block >= block_scantop) {
> + /* find a non bad block */
> + for (i = block_map[block_scantop] + 1; i < block_top; i++)
> + if ((*mtd->block_isbad)(mtd, i * mtd->erasesize) == 0)
> + break;
> +
> + /* exchausted ? */
exhausted
> +static struct mtd_blktrans_ops mtdblock_tr = {
> + .name = "mtdblock",
> + .major = 258,
> + .part_bits = 0,
> + .readsect = mtdblock_readsect,
> + .writesect = mtdblock_writesect,
> + .add_mtd = mtdblock_add_mtd,
> + .remove_dev = mtdblock_remove_dev,
> + .owner = THIS_MODULE,
> +};
You went to the trouble of getting a new major number assigned... why
not call it something other than mtdblock?
> Index: mips-kernel-2.6/drivers/mtd/Makefile
> ===================================================================
> --- mips-kernel-2.6.orig/drivers/mtd/Makefile
> +++ mips-kernel-2.6/drivers/mtd/Makefile
> @@ -17,6 +17,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o
> obj-$(CONFIG_MTD_CHAR) += mtdchar.o
> obj-$(CONFIG_MTD_BLOCK) += mtdblock.o mtd_blkdevs.o
> obj-$(CONFIG_MTD_BLOCK_RO) += mtdblock_ro.o mtd_blkdevs.o
> +obj-$(CONFIG_MTD_BLOCK_RO_BBFREE) += mtdblock_ro_bbfree.o mtd_blkdevs.o
> obj-$(CONFIG_FTL) += ftl.o mtd_blkdevs.o
> obj-$(CONFIG_NFTL) += nftl.o mtd_blkdevs.o
> obj-$(CONFIG_INFTL) += inftl.o mtd_blkdevs.o
All these mtd_blkdevs.o are starting to get ugly. Why don't we
introduce a CONFIG_MTDBLKDEVS that can be selected by the other Kconfig
options.
> Index: mips-kernel-2.6/drivers/mtd/Kconfig
> ===================================================================
> --- mips-kernel-2.6.orig/drivers/mtd/Kconfig
> +++ mips-kernel-2.6/drivers/mtd/Kconfig
> @@ -197,6 +197,13 @@ 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_RO_BBFREE
> + tristate "Readonly bad block free block device access to MTD devices"
> + depends on MTD_BLOCK!=y && MTD && MTD_BLOCK_RO!=y
> + help
> + Same as readonly block driver, but this allow you to mount read-only file
> + systems from an MTD device, containing bad blocks.
> +
This part seems hacky to me... why can't use use mtdblock or
mtdblock_ro when this is enabled? And what happens in the module case?
josh
More information about the linux-mtd
mailing list