Re: [PATCH 0/3] md: raid helper cleanups
From: "yu kuai" <yukuai@fygo.io>
Date: 2026-09-05 02:44:10
在 2026/8/27 15:56, Li Youhong 写道:
From: Li Youhong <redacted>
This series factors a few repeated md/raid patterns into small helpers.
There is no intentional behaviour change; each patch is a mechanical
extract of existing logic.
Patch 1 adds rdev_record_write_error() in md.h for the
WriteErrorSeen + WantReplacement + MD_RECOVERY_NEEDED sequence shared by
raid1, raid10 and raid5.
Patches 2 and 3 move raid1/raid10-only helpers into raid1-10.c, which is
#included by both drivers:
- rdev_bb_block_sectors() for the badblocks-aligned block size used in
narrow_write_error()
- flush_bio_list() for the bitmap plug flush path previously duplicated
in raid10's flush_pending_writes() and raid10_unplug()
The helpers in raid1-10.c follow the existing static inline convention
used by raid1_submit_write(), check_decay_read_errors(), and others in
that file.
Li Youhong (3):
md: add rdev_record_write_error() helper
md/raid1-10: add rdev_bb_block_sectors() helper
md/raid1-10: share flush_bio_list between raid1 and raid10
---
drivers/md/md.h | 7 +++++++
drivers/md/raid1-10.c | 27 +++++++++++++++++++++++++++
drivers/md/raid1.c | 42 +++++++-----------------------------------
drivers/md/raid10.c | 50 +++++++-------------------------------------------
drivers/md/raid5.c | 5 +----
5 files changed, 48 insertions(+), 83 deletions(-)Reviewed-by: Yu Kuai <yukuai@fygo.io> Noted only bug fix can be accepted for current merge window, cleanup patches will be applied later for 6.4. -- Thanks, Kuai