Re: [PATCH v4 2/7] md/raid1: restrict atomic write limits and handle runtime constraints

From: yu kuai

Date: Wed Jul 15 2026 - 05:18:23 EST


在 2026/7/10 18:15, Abd-Alrhman Masalkhi 写道:

> Restrict the RAID1 atomic write limits by setting chunk_sectors to
> BARRIER_UNIT_SECTOR_SIZE so that atomic writes never straddle a barrier
> unit.
>
> A bio that passes block-layer validation may still become unserviceable
> within RAID1 due to bad blocks or write-behind constraints. In the former
> case, complete the bio with EIO. In the latter case, disable
> write-behind rather than failing the bio with EIO.
>
> Fixes: f2a38abf5f1c ("md/raid1: Atomic write support")
> Fixes: a4c55c902670 ("md/raid1: simplify raid1_write_request() error handling")
> Reviewed-by: John Garry<john.g.garry@xxxxxxxxxx>
> Signed-off-by: Abd-Alrhman Masalkhi<abd.masalkhi@xxxxxxxxx>
> ---
> Changes in v4:
> - Improve the commit message.
> - Add Reviewed-by tag from John Garry.
> - Link to v3:https://lore.kernel.org/linux-raid/20260708101341.473750-3-abd.masalkhi@xxxxxxxxx/
>
> Changes in v3:
> - Set chunk_sectors to BARRIER_UNIT_SECTOR_SIZE instead of setting
> atomic_write_hw_unit_max.
> - Avoid enabling write-behind when the atomic write exceeds the
> write-behind limit.
> - Link to v2:https://lore.kernel.org/linux-raid/20260628142420.1051027-3-abd.masalkhi@xxxxxxxxx/
>
> Changes in v2:
> - Drop the early atomic write split check from raid1_write_request().
> - Advertise the atomic write size limit via queue limits.
> - Disable write-behind instead of failing atomic writes when the
> BIO_MAX_VECS limit is encountered.
> - Link to v1:https://lore.kernel.org/linux-raid/20260623072456.333437-3-abd.masalkhi@xxxxxxxxx/
> ---
> drivers/md/raid1.c | 25 ++++++++++---------------
> 1 file changed, 10 insertions(+), 15 deletions(-)
Reviewed-by: Yu Kuai <yukuai@xxxxxxx>

--
Thanks,
Kuai