Thread (18 messages) 18 messages, 4 authors, 2026-01-14

[PATCH v4 00/11] md: align bio to io_opt for better performance

STALE260d

From: Yu Kuai <hidden>
Date: 2026-01-12 04:29:14

Revision v4 of 3 in this series.

Revisions (3)
  1. v3 [diff vs current]
  2. v4 current
  3. v5 [diff vs current]
This patchset optimizes MD RAID performance by aligning bios to the
optimal I/O size before splitting. When I/O is aligned to io_opt,
raid5 can perform full stripe writes without needing to read extra
data for parity calculation, significantly improving bandwidth.

Patches 1-3: Cleanup - merge boolean fields into mddev_flags
Patches 4-5: Preparation - use mempool for stripe_request_ctx and
             ensure max_sectors >= io_opt
Patches 6-7: Core - add bio alignment infrastructure
Patches 8-10: Enable bio alignment for raid5, raid10, and raid0
Patch 11: Fix abnormal io_opt from member disks

Performance improvement on 32-disk raid5 with 64kb chunk:
  dd if=/dev/zero of=/dev/md0 bs=100M oflag=direct
  Before: 782 MB/s
  After:  1.1 GB/s

Changes in v4:
- Patch 11: Simplify by checking rdev_is_mddev() first, remove
  MD_STACK_IO_OPT flag

Changes in v3:
- Patch 4: Remove unnecessary NULL check before mempool_destroy()
- Patch 6: Use sector_div() instead of roundup()/rounddown() to fix
  64-bit division issue on 32-bit platforms

Changes in v2:
- Fix mempool in patch 4
- Add prep cleanup patches, 1-3
- Add patch 11 to fix abnormal io_opt
- Add Link tags to patches

Yu Kuai (11):
  md: merge mddev has_superblock into mddev_flags
  md: merge mddev faillast_dev into mddev_flags
  md: merge mddev serialize_policy into mddev_flags
  md/raid5: use mempool to allocate stripe_request_ctx
  md/raid5: make sure max_sectors is not less than io_opt
  md: support to align bio to limits
  md: add a helper md_config_align_limits()
  md/raid5: align bio to io_opt
  md/raid10: align bio to io_opt
  md/raid0: align bio to io_opt
  md: fix abnormal io_opt from member disks

 drivers/md/md-bitmap.c |   4 +-
 drivers/md/md.c        | 118 +++++++++++++++++++++++++++++++++++------
 drivers/md/md.h        |  30 +++++++++--
 drivers/md/raid0.c     |   6 ++-
 drivers/md/raid1-10.c  |   5 --
 drivers/md/raid1.c     |  13 ++---
 drivers/md/raid10.c    |  10 ++--
 drivers/md/raid5.c     |  92 ++++++++++++++++++++++----------
 drivers/md/raid5.h     |   3 ++
 9 files changed, 215 insertions(+), 66 deletions(-)

-- 
2.51.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help