[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250619111806.3546162-4-yi.zhang@huaweicloud.com>
Date: Thu, 19 Jun 2025 19:18:00 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: linux-fsdevel@...r.kernel.org,
linux-ext4@...r.kernel.org,
linux-block@...r.kernel.org,
dm-devel@...ts.linux.dev,
linux-nvme@...ts.infradead.org,
linux-scsi@...r.kernel.org
Cc: linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
hch@....de,
tytso@....edu,
djwong@...nel.org,
john.g.garry@...cle.com,
bmarzins@...hat.com,
chaitanyak@...dia.com,
shinichiro.kawasaki@....com,
brauner@...nel.org,
martin.petersen@...cle.com,
yi.zhang@...wei.com,
yi.zhang@...weicloud.com,
chengzhihao1@...wei.com,
yukuai3@...wei.com,
yangerkun@...wei.com
Subject: [PATCH v2 3/9] nvmet: set WZDS and DRB if device enables unmap write zeroes operation
From: Zhang Yi <yi.zhang@...wei.com>
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@...wei.com>
---
drivers/nvme/target/io-cmd-bdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index eba42df2f821..31d6c4a63fa5 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -46,6 +46,10 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
id->npda = id->npdg;
/* NOWS = Namespace Optimal Write Size */
id->nows = to0based(bdev_io_opt(bdev) / bdev_logical_block_size(bdev));
+
+ /* Set WZDS and DRB if device supports unmapped write zeroes */
+ if (bdev_write_zeroes_unmap_sectors(bdev))
+ id->dlfeat = (1 << 3) | 0x1;
}
void nvmet_bdev_ns_disable(struct nvmet_ns *ns)
--
2.46.1
Powered by blists - more mailing lists