[PATCH 0/3] mtd: block2mtd: convert to folios

Tal Zussman tz2294 at columbia.edu
Wed Oct 14 20:34:53 PDT 2026


block2mtd still goes through the page wrappers around the folio page
cache API, each of which hides a compound_head() call. Convert the read,
write and erase paths to use folios directly. This removes a
compound_head() call per page in the read path and four per page in the
write and erase paths, and leaves the driver with no struct page usage.

Tested on KVM with the MTD test modules and fsx/fsstress on UBIFS with
no errors.

The numbers below are from mtd_speedtest, in MiB/s, by folio size,
except the last row, which is from the MEMERASE ioctl:

+------------------------------+-------+--------+---------+---------+
| Test                         | Folio |   Base | Patched |  Change |
+------------------------------+-------+--------+---------+---------+
| Eraseblock read (128 KiB)    |   4K  |  12545 |   12863 |   +2.5% |
|                              |  16K  |  12998 |   17229 |  +32.6% |
|                              |  64K  |  13009 |   19135 |  +47.1% |
+------------------------------+-------+--------+---------+---------+
| Eraseblock write (128 KiB)   |   4K  |   8773 |    8063 |  noisy* |
|                              |  16K  |   9529 |   13448 |  +41.1% |
|                              |  64K  |   9636 |   15934 |  +65.4% |
+------------------------------+-------+--------+---------+---------+
| Page read (512 B)            |   4K  |   3332 |    3501 |   +5.1% |
|                              |  16K  |   3332 |    3462 |   +3.9% |
|                              |  64K  |   3330 |    3479 |   +4.5% |
+------------------------------+-------+--------+---------+---------+
| Page write (512 B)           |   4K  |   2001 |    2054 |   +2.6% |
|                              |  16K  |   2000 |    2059 |   +3.0% |
|                              |  64K  |   2001 |    2064 |   +3.1% |
+------------------------------+-------+--------+---------+---------+
| 2-page read (1 KiB)          |   4K  |   5262 |    5436 |   +3.3% |
|                              |  16K  |   5292 |    5327 |   +0.7% |
|                              |  64K  |   5312 |    5385 |   +1.4% |
+------------------------------+-------+--------+---------+---------+
| 2-page write (1 KiB)         |   4K  |   3635 |    3712 |   +2.1% |
|                              |  16K  |   3650 |    3725 |   +2.1% |
|                              |  64K  |   3665 |    3768 |   +2.8% |
+------------------------------+-------+--------+---------+---------+
| Erase, blocks hold data      |   4K  |  15013 |  ~15900 |   ~+6%* |
| (mtd_speedtest)              |  16K  |  15222 |   22849 |  +50.1% |
|                              |  64K  |  15280 |   24233 |  +58.6% |
+------------------------------+-------+--------+---------+---------+
| Erase, already erased        |   4K  |   9558 |   13727 |  +43.6% |
| (MEMERASE ioctl)             |  16K  |   9558 |   16580 |  +73.5% |
|                              |  64K  |   9626 |   17754 |  +84.4% |
+------------------------------+-------+--------+---------+---------+

---
Tal Zussman (3):
      mtd: block2mtd: convert block2mtd_read() to folios
      mtd: block2mtd: convert _block2mtd_write() to folios
      mtd: block2mtd: convert _block2mtd_erase() to folios

 drivers/mtd/devices/block2mtd.c | 120 +++++++++++++++++-----------------------
 1 file changed, 51 insertions(+), 69 deletions(-)
---
base-commit: 2f7fa8d90694d21dce68ceabd8383252b111cfea
change-id: 20261012-block2mtd-folio-9ccb6639c05a

Best regards,
--  
Tal Zussman <tz2294 at columbia.edu>




More information about the linux-mtd mailing list