Re: [PATCH 10/13] block: introduce BLKREPORTZONESV2 ioctl

Bart Van Assche
2025-10-31T16:52:32Z

On 10/30/25 11:13 PM, Damien Le Moal wrote:
> Unlike the existing BLKREPORTZONES ioctl, this new ioctl uses the flags
> field of struct blk_zone_report also as an inpiut. If as an input, the

inpiut -> input

> /*
> - * BLKREPORTZONE ioctl processing.
> + * Mask of valid input flags for BLKREPORTZONEV2 ioctl.
> + */
> +#define BLK_ZONE_REPV2_INPUT_FLAGS (BLK_ZONE_REP_CACHED)

Parentheses are not needed here - the definition of BLK_ZONE_REP_CACHED
should include parentheses if necessary.

> + case BLKREPORTZONEV2:
> + if (rep.flags & ~BLK_ZONE_REPV2_INPUT_FLAGS)
> + return -EINVAL;

-EINVAL probably should be changed into something that indicates "not
supported" rather than "invalid argument"?

> index dab5d9700898..1441d79a6173 100644
> --- a/include/uapi/linux/blkzoned.h
> +++ b/include/uapi/linux/blkzoned.h
> @@ -82,10 +82,20 @@ enum blk_zone_cond {
> /**
> * enum blk_zone_report_flags - Feature flags of reported zone descriptors.
> *
> - * @BLK_ZONE_REP_CAPACITY: Zone descriptor has capacity field.
> + * @BLK_ZONE_REP_CAPACITY: Output only. Indicates that zone descriptors in a
> + * zone report have a valid capacity field.
> + * @BLK_ZONE_REP_CACHED: Input only. Indicates that the zone report should be
> + * generated using cached zone information. In this case,
> + * the implicit open, explicit open and closed zone
> + * conditions are all reported with the
> + * BLK_ZONE_COND_ACTIVE condition.
> */
> enum blk_zone_report_flags {
> + /* Output flags */
> BLK_ZONE_REP_CAPACITY = (1 << 0),
> +
> + /* Input flags */
> + BLK_ZONE_REP_CACHED = (1 << 31),
> };

Why 1 << 31 instead of 1 << 1?

Otherwise this patch looks good to me.

Thanks,

Bart.