]> asedeno.scripts.mit.edu Git - linux.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)
commit6e02318eaea53eaafe628c4ffc254f57b2704561
tree1babb7bb77a4e48a21b1fb63b901166e8314b200
parentbb94aea1444b9859faa8d72aff3713fcd11c6696
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