Re: [PATCH v4 20/25] md/raid10: wire llbitmap reshape lifecycle

[email protected] Sat, 01 Aug 2026 18:28:55 +0000
Newsgroups org.kernel.vger.linux-raid
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(=
s) to consider:
- [Low] Inconsistent abstraction usage in bitmap reshape lifecycle hooks, c=
hecking specific bitmap ID only in finish phase.
--

--- Patch [20]: [PATCH v4 20/25] md/raid10: wire llbitmap reshape lifecycle=
 ---
commit 2fc96f9ae1ba07f2366bbf0c6db64db484bf74ad
Author: Yu Kuai <[email protected]>

md/raid10: wire llbitmap reshape lifecycle

This commit prepares the llbitmap before RAID10 starts growing and finishes
the geometry update when reshape completes. It also exports the old and new
tracked sizes.

> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -4394,6 +4394,12 @@ static int raid10_start_reshape(struct mddev *mdde=
v)
> =20
>  	if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery))
>  		return -EBUSY;
> +	if (md_bitmap_enabled(mddev, false) &&
> +	    mddev->bitmap_ops->reshape_can_start) {
> +		ret =3D mddev->bitmap_ops->reshape_can_start(mddev);
> +		if (ret)
> +			return ret;
> +	}

[ ... ]

> @@ -5039,10 +5062,15 @@ static void end_reshape_request(struct r10bio *r1=
0_bio)
>  static void raid10_finish_reshape(struct mddev *mddev)
>  {
>  	struct r10conf *conf =3D mddev->private;
> +	bool llbitmap =3D mddev->bitmap_id =3D=3D ID_LLBITMAP &&
> +		md_bitmap_enabled(mddev, false);
> =20
>  	if (test_bit(MD_RECOVERY_INTR, &mddev->recovery))
>  		return;
> =20
> +	if (llbitmap && mddev->bitmap_ops->reshape_finish)
> +		mddev->bitmap_ops->reshape_finish(mddev);

[Severity: Low]
This isn't a bug, but is it intentional to explicitly check for ID_LLBITMAP
here in raid10_finish_reshape()?

In earlier hooks like raid10_start_reshape() shown above, the code relies
entirely on the presence of the function pointer:

    if (md_bitmap_enabled(mddev, false) &&
        mddev->bitmap_ops->reshape_can_start)

If another bitmap provider implements reshape_finish() in the future,
would this hardcoded ID check silently prevent its hook from running?

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260801172519.2982=
[email protected]?part=3D20