Skip to content

Commit aae87d2

Browse files
zhangyi089kawasaki
authored andcommitted
nvmet: set WZDS and DRB if device supports BLK_FEAT_WRITE_ZEROES_UNMAP
Set WZDS and DRB bit to the namespace dlfeat if the underlying block device supports BLK_FEAT_WRITE_ZEROES_UNMAP, make the nvme target device supports unmaped write zeroes command. Signed-off-by: Zhang Yi <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 193890b commit aae87d2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/nvme/target/io-cmd-bdev.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id)
4646
id->npda = id->npdg;
4747
/* NOWS = Namespace Optimal Write Size */
4848
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(bdev))
52+
id->dlfeat = (1 << 3) | 0x1;
4953
}
5054

5155
void nvmet_bdev_ns_disable(struct nvmet_ns *ns)

0 commit comments

Comments
 (0)