Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvmet: set WZDS and DRB if device enables unmap write zeroes operation

Set the WZDS and DRB bits to the namespace dlfeat if the underlying
block device enables the unmap write zeroes operation, make the nvme
target device supports the unmap write zeroes command.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://lore.kernel.org/20250619111806.3546162-4-yi.zhang@huaweicloud.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Zhang Yi and committed by
Christian Brauner
50634366 545fb46e

+4
+4
drivers/nvme/target/io-cmd-bdev.c
··· 46 46 id->npda = id->npdg; 47 47 /* NOWS = Namespace Optimal Write Size */ 48 48 id->nows = to0based(bdev_io_opt(bdev) / bdev_logical_block_size(bdev)); 49 + 50 + /* Set WZDS and DRB if device supports unmapped write zeroes */ 51 + if (bdev_write_zeroes_unmap_sectors(bdev)) 52 + id->dlfeat = (1 << 3) | 0x1; 49 53 } 50 54 51 55 void nvmet_bdev_ns_disable(struct nvmet_ns *ns)