Re: [Patch V2] md/raid: use assign_bit() where applicable
From: yu kuai
Date: Wed Sep 23 2026 - 07:22:12 EST
在 2026/9/21 16:10, Peng Fan (OSS) 写道:
> From: Peng Fan<peng.fan@xxxxxxx>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>
> Done with Coccinelle semantic patch:
> // set_bit -> clear_bit => assign_bit
>
> @@
> expression cond, bit, addr;
> @@
>
> -if (cond)
> - set_bit(bit, addr);
> -else
> - clear_bit(bit, addr);
> +assign_bit(bit, addr, cond);
>
> // clear_bit -> set_bit => assign_bit
>
> @@
> expression cond, bit, addr;
> @@
>
> -if (cond)
> - clear_bit(bit, addr);
> -else
> - set_bit(bit, addr);
> +assign_bit(bit, addr, !cond);
>
> Signed-off-by: Peng Fan<peng.fan@xxxxxxx>
> ---
>
> V2:
> Separate device-mapper and mraid
> https://lore.kernel.org/all/20260918141737.3023011-1-peng.fan@xxxxxxxxxxx/
>
> drivers/md/md.c | 22 ++++++----------------
> drivers/md/raid5-cache.c | 6 ++----
> drivers/md/raid5.c | 6 ++----
> 3 files changed, 10 insertions(+), 24 deletions(-)
Applied to md-7.4
--
Thanks,
Kuai