[PATCH blktests] nvme/080: test write zeroes larger than 65536 logical blocks
Chaitanya Kulkarni
chaitanyak at nvidia.com
Tue Nov 17 11:45:07 PST 2026
On 11/16/26 9:26 PM, Ankit Gupta wrote:
> The NVMe Write Zeroes command encodes the number of logical blocks in a
> zero-based 16-bit field. When the controller reports neither MDTS nor
> WZSL, as nvmet-tcp does by default, the host advertised an unbounded
> write zeroes limit, truncated the block count when building the command
> and completed the request successfully after zeroing only a prefix.
>
> Add a regression test for the kernel patch "nvme: limit Write Zeroes to
> 65536 logical blocks" [1]. Fill 65536 logical blocks plus 1 MiB with a
> non-zero pattern, zero that range with blkdiscard -z and check that the
> whole range reads back as zeroes. The length scales with the logical
> block size, so the test covers both 512-byte and 4096-byte namespaces.
>
> [1]https://lore.kernel.org/linux-nvme/20261117011230.10288-1-ankit6791@gmail.com/
>
> Signed-off-by: Ankit Gupta<ankit6791 at gmail.com>
> ---
> Tested on arm64 with v7.4-rc3 (aebb72744764), NVMET_TRTYPES="loop tcp"
> and NVMET_BLKDEV_TYPES="device file". Without the kernel patch the test
> fails for tcp with both block device types ("zeroed range still contains
> non-zero data"). With the patch it passes for tcp and loop with both
> types. The device type gives 512-byte logical blocks (33 MiB zeroed) and
> the file type 4096-byte logical blocks (257 MiB zeroed). With
> NVME_IMG_SIZE=64m the device type still runs and the file type is
> skipped.
>
> Claude and Codex assisted with writing and validating this test.
Thanks a lot for the test, overall looks good to me.
Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>
-ck
More information about the Linux-nvme
mailing list