Re: [PATCH 04/14] block: remember a zone type regardless of its condition

Bart Van Assche <[email protected]> Wed, 5 Aug 2026 14:20:43 -0700
Newsgroups org.kernel.vger.linux-block
Message-ID <[email protected]>
On 8/4/26 7:27 PM, Damien Le Moal wrote:
> +static inline enum blk_zone_cond blk_zstate_to_zone_cond(enum blk_zstate zs)
> +{
> +	u8 idx = zs & BLK_ZSTATE_COND_MASK;
> +
> +	if (WARN_ON(idx >= ARRAY_SIZE(blk_zstate2zcond)))
> +		return 0;
> +
> +	return blk_zstate2zcond[idx];
> +}

Isn't WARN_ON_ONCE() preferred over WARN_ON()?

> +static inline enum blk_zstate blk_zone_cond_to_zstate(enum blk_zone_cond cond)
> +{
> +	if (cond == BLK_ZONE_COND_ACTIVE)
> +		return BLK_ZSTATE_ACTIVE;
> +
> +	if (WARN_ON(cond >= ARRAY_SIZE(blk_zcond2zstate)))
> +		return 0;
> +
> +	return blk_zcond2zstate[cond];
> +}

Same question here - isn't WARN_ON_ONCE() preferred over WARN_ON()?

>   		default:
> -			blk_zone_set_cond(zones_cond, zno, cond);
> +			blk_zstate_set(zones_state, zno, cond,
> +				       blk_zstate_flags(zones_state[zno]));

This is an open-coded implementation of FIELD_MODIFY(), isn't it?

Thanks,

Bart.