Skip to content

mtd: write support for minor-aligned partitions

Thibaut VARÈNE linux-mtd 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v3 Latest3 patches 2 repliesIn review

Changes in v3 from the cover letter

- Split patch into incremental, functionally-separate changes.
- Adjusted erasesize_minor assignment check in spi-nor/core.c
- Addressed checkpatch warning on "printk(KERN_WARNING..."
- Documented new sysfs attribute

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3mtd: mtdpart: write support for minor-aligned partitionsDocumentation/ABI/testing/sysfs-class-mtd drivers/mtd/mtdcore.c drivers/mtd/mtdpart.c +1 more+45 -100 replies
2/3mtd: spi-nor: set erasesize_minor for non-uniform erasedrivers/mtd/spi-nor/core.c+8 -30 replies
3/3mtd: spi-nor: allow overriding uniform erasedrivers/mtd/spi-nor/Kconfig drivers/mtd/spi-nor/core.c+12 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] mtd: write support for minor-aligned partitions

This patch series enable write support for minor-aligned mtd partitions on devices that support multiple erasesizes.

On supporting hardware, they enable RW operations on mtd partitions that break "major" (largest) erasesize boundary (e.g. too small or not correctly aligned) without sacrificing performance (i.e. forcing everything to use 4K sectors). Finally, they address an historical FIXME in mtdpart.c.

The following performance numbers were measured with v5.10 kernel on OpenWrt:
(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y forces the use of the new code path)

OpenWrt 5.10 ramips MT7621 w25q128jv 0xfc0000 firmware partition length time mtd erase firmware

Without this patch:
MTD_SPI_NOR_USE_4K_SECTORS=n |y

real    0m 50.86s		|2m 11.66s
user    0m 0.00s		|0m 0.00s
sys     0m 50.80s		|1m 56.20s

can write minor-aligned parts? N|Y

With this patch:
MTD_SPI_NOR_USE_VARIABLE_ERASE=n|y |4K_SECTORS=y

real    0m 51.68s		|0m 50.85s	|2m 12.89s
user    0m 0.00s		|0m 0.00s	|0m 0.01s
sys     0m 46.94s		|0m 50.38s	|2m 12.46s

can write minor-aligned parts? N|Y |Y

NB: This patchset was previously submitted as a monolithic patch (RFC[0], v1[1]). While not submitted upstream v2 was however reviewed, tested and accepted in OpenWrt, and backported into the upcoming 22.03 stable branch:
https://github.com/openwrt/openwrt/pull/3271

[0] [email protected]
[1] [email protected]

Changes v2 -> v3:
- Split patch into incremental, functionally-separate changes.
- Adjusted erasesize_minor assignment check in spi-nor/core.c
- Addressed checkpatch warning on "printk(KERN_WARNING..."
- Documented new sysfs attribute

Changes v1 -> v2:
- Added mtdcore sysfs attribute for erasesize_minor
- Removed finding minor erasesize for variable erase regions device, (untested and no response to RFC).
- Moved IF_ENABLED() to guard setting erasesize_minor in spi-nor/core.c
- Removed setting major erasesize to minor where partition boundaries require minor erase to be writable
- Simplified minor boundary check by relying on minor being a factor of major

Changes RFC -> v1:
- Fixed uninitialized variable smatch warning

Thibaut VARÈNE (3):
mtd: mtdpart: write support for minor-aligned partitions
mtd: spi-nor: set erasesize_minor in spi_nor_select_erase()
mtd: spi-nor: allow overriding uniform erase

 Documentation/ABI/testing/sysfs-class-mtd |  8 ++++++
 drivers/mtd/mtdcore.c                     | 10 +++++++
 drivers/mtd/mtdpart.c                     | 35 ++++++++++++++++-------
 drivers/mtd/spi-nor/Kconfig               | 10 +++++++
 drivers/mtd/spi-nor/core.c                | 13 +++++++--
 include/linux/mtd/mtd.h                   |  2 ++
 6 files changed, 65 insertions(+), 13 deletions(-)

base-commit: e0dccc3b76fb35bb257b4118367a883073d7390e

Signature · 6 lines
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/