Commit 285e6670 authored by Matthew R. Ochs's avatar Matthew R. Ochs Committed by Martin K. Petersen

scsi: cxlflash: Use derived maximum write same length

The existing write same routine within the cxlflash driver uses a
statically defined value for the maximum write same transfer length.
While this is close to the value reflected by the original device that
was supported by cxlflash, newer devices are capable of much larger
lengths. Supporting what the device is capable of offers substantial
performance improvement as the scrub routine within cxlflash operates on
'chunk size' units (256MB with a 4K sector size).

Instead of a #define, use the write same maximum length that is stored
in the block layer in units of 512 byte sectors. This value is initially
determined from the block limits VPD page during device discovery and
can also be manipulated from sysfs. As a general cleanup, designate the
timeout used when executing the write same command as constant.
Signed-off-by: default avatarMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: default avatarUma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4a6125c5
...@@ -548,7 +548,4 @@ struct sisl_rht_entry_f1 { ...@@ -548,7 +548,4 @@ struct sisl_rht_entry_f1 {
#define TMF_LUN_RESET 0x1U #define TMF_LUN_RESET 0x1U
#define TMF_CLEAR_ACA 0x2U #define TMF_CLEAR_ACA 0x2U
#define SISLITE_MAX_WS_BLOCKS 512
#endif /* _SISLITE_H */ #endif /* _SISLITE_H */
...@@ -428,12 +428,14 @@ static int write_same16(struct scsi_device *sdev, ...@@ -428,12 +428,14 @@ static int write_same16(struct scsi_device *sdev,
u8 *sense_buf = NULL; u8 *sense_buf = NULL;
int rc = 0; int rc = 0;
int result = 0; int result = 0;
int ws_limit = SISLITE_MAX_WS_BLOCKS;
u64 offset = lba; u64 offset = lba;
int left = nblks; int left = nblks;
u32 to = sdev->request_queue->rq_timeout;
struct cxlflash_cfg *cfg = shost_priv(sdev->host); struct cxlflash_cfg *cfg = shost_priv(sdev->host);
struct device *dev = &cfg->dev->dev; 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;
cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL); cmd_buf = kzalloc(CMD_BUFSIZE, GFP_KERNEL);
scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL); scsi_cmd = kzalloc(MAX_COMMAND_SIZE, GFP_KERNEL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment