diff mbox series

[1/7] cxlflash: query write_zeroes limit for zeroing

Message ID 20220209082828.2629273-2-hch@lst.de (mailing list archive)
State Accepted
Commit 898cd34607eb093c778216b1e201615c65bc7f31
Headers show
Series [1/7] cxlflash: query write_zeroes limit for zeroing | expand

Commit Message

Christoph Hellwig Feb. 9, 2022, 8:28 a.m. UTC
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 quering the write zeroes
limit for a zeroing WRITE SAME operation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/scsi/cxlflash/vlun.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Chaitanya Kulkarni Feb. 9, 2022, 8:43 a.m. UTC | #1
On 2/9/22 12:28 AM, Christoph Hellwig wrote:
> 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 quering the write zeroes
> limit for a zeroing WRITE SAME operation.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
diff mbox series

Patch

diff --git a/drivers/scsi/cxlflash/vlun.c b/drivers/scsi/cxlflash/vlun.c
index 01917b28cdb65..5c74dc7c22889 100644
--- a/drivers/scsi/cxlflash/vlun.c
+++ b/drivers/scsi/cxlflash/vlun.c
@@ -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);