scsi: cxlflash: Query write_zeroes limit for zeroing
authorChristoph Hellwig <hch@lst.de>
Wed, 9 Feb 2022 08:28:22 +0000 (09:28 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Feb 2022 02:11:08 +0000 (21:11 -0500)
The write_same and write_zeroes limits for SCSI are effectively the same,
so the current code works just fine.  But we plan to remove
REQ_OP_WRITE_SAME support, so switch to querying the write zeroes limit for
a zeroing WRITE SAME operation.

Link: https://lore.kernel.org/r/20220209082828.2629273-2-hch@lst.de
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/vlun.c

index 01917b2..5c74dc7 100644 (file)
@@ -430,8 +430,8 @@ static int write_same16(struct scsi_device *sdev,
        struct device *dev = &cfg->dev->dev;
        const u32 s = ilog2(sdev->sector_size) - 9;
        const u32 to = sdev->request_queue->rq_timeout;
-       const u32 ws_limit = blk_queue_get_max_sectors(sdev->request_queue,
-                                                      REQ_OP_WRITE_SAME) >> s;
+       const u32 ws_limit =
+               sdev->request_queue->limits.max_write_zeroes_sectors >> s;
 
        cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
        scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);