[PATCH v2 1/9] block: introduce max_{hw|user}_wzeroes_unmap_sectors to queue limits
John Garry
john.g.garry at oracle.com
Thu Aug 21 05:55:10 PDT 2025
On 19/06/2025 12:17, Zhang Yi wrote:
> }
> @@ -333,6 +335,12 @@ int blk_validate_limits(struct queue_limits *lim)
> if (!lim->max_segments)
> lim->max_segments = BLK_MAX_SEGMENTS;
>
> + if (lim->max_hw_wzeroes_unmap_sectors &&
> + lim->max_hw_wzeroes_unmap_sectors != lim->max_write_zeroes_sectors)
> + return -EINVAL;
JFYI, I noticed that I am failing this check in raid0_set_limits() ->
queue_limits_set() -> queue_limits_commit_update() ->
blk_validate_limits() for v6.17-rc2
The raid0 array consists of NVMe partitions. Here
lim->max_hw_wzeroes_unmap_sectors = 4096 and
lim->max_write_zeroes_sectors = 0 values for the failure, above.
john at raspberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_max_bytes
2097152
john at raspberrypi:~ $ cat
/sys/block/nvme0n1/queue/write_zeroes_unmap_max_bytes
2097152
john at raspberrypi:~ $ cat
/sys/block/nvme0n1/queue/write_zeroes_unmap_max_hw_bytes
2097152
john at raspberrypi:~ $
> + lim->max_wzeroes_unmap_sectors = min(lim->max_hw_wzeroes_unmap_sectors,
> + lim->max_user_wzeroes_unmap_sectors);
> +
> lim->max_discard_sectors =
> min(lim->max_hw_discard_sectors, lim->max_user_discard_sectors);
>
> @@ -418,10 +426,11 @@ int blk_set_default_limits(struct queue_limits *lim)
More information about the Linux-nvme
mailing list