[PATCH] mtdpart: More flexible dynamic partitioning

Ezequiel Garcia ezequiel.garcia at imgtec.com
Tue Feb 10 13:50:55 PST 2015

On 02/05/2015 03:48 PM, Dan Ehrenberg wrote:
> MTD allows dynamic partitioning by the BLKPG ioctl.
> This patch makes dynamic partitioning more flexible by:
> - Allowing addition of a partition to be added on top of another
>   partition. The two partitions compose naturally: the offsets are added
>   and lengths are checked to be in bounds. This is useful when
>   repartitioning an existing partitioned device since the underlying
>   device doesn't exist to add partitions to.

IMHO, this explanation is not that clear. In particular "Allowing
addition of a partition to be added on top of another partition"
looks odd to me.

Maybe you can say something like: "The current code restricts partition
dynamic addition to work only on the master MTD device. This doesn't
make a lot of sense, and is impossible to meet if the device is already
partitioned (since the master MTD device is not visible). This commit
removes the restriction."

> - Removing overlap checks for dynamic partitions. I don't see any
>   particular reason why overlapping dynamic partitions should be
>   prohibited while static partitions are allowed to overlap freely, and
>   this is useful for users who want one additional partition to span
>   over the whole device.

Makes sense.

> - Allowing partitions to be deleted by referencing any partition with
>   the same master. For example, if you have /dev/mtd0 and /dev/mtd1 both
>   partitions on the same underlying device, then you can call
>   BLKPG_DEL_PARTITION with an fd of /dev/mtd0 and pno of /dev/mtd1, and
>   /dev/mtd1 will be deleted (as opposed to returning EINVAL to signal a
>   missing partition, which it did previously).

Should we split this in two or three patches? Don't have a strong opinion.

More information about the linux-mtd mailing list