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@raspberrypi:~ $ cat /sys/block/nvme0n1/queue/write_zeroes_max_bytes
2097152
john@raspberrypi:~ $ cat
/sys/block/nvme0n1/queue/write_zeroes_unmap_max_bytes
2097152
john@raspberrypi:~ $ cat
/sys/block/nvme0n1/queue/write_zeroes_unmap_max_hw_bytes
2097152
john@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)