]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: add support for the Write Zeroes command
authorChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Tue, 18 Dec 2018 03:42:03 +0000 (22:42 -0500)
committerChristoph Hellwig <hch@lst.de>
Mon, 4 Feb 2019 14:41:25 +0000 (15:41 +0100)
commit15e6d6fe45a55805cfb5e182e20134183ad3e1a0
tree1babb7bb77a4e48a21b1fb63b901166e8314b200
parent596ebce951e336296fa21b90dbaf1767d235bf27
nvme: add support for the Write Zeroes command

Allow write zeroes operations (REQ_OP_WRITE_ZEROES) on the block
device, if the device supports an optional command bit set for write
zeroes. Add support to setup write zeroes command. Set maximum possible
write zeroes sectors in one write zeroes command according to
nvme write zeroes command definition.

This patch was posted as a part of block-write-zeroes support
implementation (https://patchwork.kernel.org/patch/9454859/),
but did not make into mainline kernel as it got reverted due to
failure on the Linus's machine.

In this patch in order to be more cautious, we use NVMe controller's
maximum hardware sector size which is calculated based on the
controller's MDTS (Maximum Data Transfer Size) field to calculate
the maximum sectors for the write zeroes request.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
[folded a fix from Keith Busch to properly respect
 NVME_QUIRK_DEALLOCATE_ZEROES]
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c