Re: [PATCH v2 07/11] md: factor out sync completion update into helper

From: Yu Kuai

Date: Sat Nov 08 2025 - 05:30:30 EST


在 2025/11/6 19:59, linan666@xxxxxxxxxxxxxxx 写道:

> Repeatedly reading 'mddev->recovery' flags in md_do_sync() may introduce
> potential risk if this flag is modified during sync, leading to incorrect
> offset updates. Therefore, replace direct 'mddev->recovery' checks with
> 'action'.
>
> Move sync completion update logic into helper md_finish_sync(), which
> improves readability and maintainability.
>
> The reshape completion update remains safe as it only updated after
> successful reshape when MD_RECOVERY_INTR is not set and 'curr_resync'
> equals 'max_sectors'.
>
> Signed-off-by: Li Nan<linan122@xxxxxxxxxx>
> ---
> drivers/md/md.c | 82 ++++++++++++++++++++++++++++---------------------
> 1 file changed, 47 insertions(+), 35 deletions(-)

LGTM
Reviewed-by: Yu Kuai <yukuai@xxxxxxxxx>