• Chaitanya Kulkarni's avatar
    nvme: add support for the Write Zeroes command · 6e02318e
    Chaitanya Kulkarni authored
    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: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
    Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    [folded a fix from Keith Busch to properly respect
     NVME_QUIRK_DEALLOCATE_ZEROES]
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    6e02318e
core.c 98 KB