summaryrefslogtreecommitdiff
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2022-03-02 00:35:51 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2022-05-02 16:59:11 -0400
commite38d9e83a376923454af599b2add53e71cd7508a (patch)
tree16b5f3008b4867f3b842277c3e633506e63f5abe /drivers/scsi/sd.c
parentd657700ccac71da19a4d1a591fafcd598ce0dd6e (diff)
scsi: sd: Use cached ATA Information VPD page
Since the ATA Information VPD is now cached at device discovery time it is no longer necessary to request this page when we configure WRITE SAME. Instead use the cached information to determine if this disk sits behind a SCSI-ATA translation layer. Link: https://lore.kernel.org/r/20220302053559.32147-7-martin.petersen@oracle.com Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index dc6e55761fd1..027738af5a22 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2996,8 +2996,7 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
}
if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) {
- /* too large values might cause issues with arcmsr */
- int vpd_buf_len = 64;
+ struct scsi_vpd *vpd;
sdev->no_report_opcodes = 1;
@@ -3005,8 +3004,11 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
* CODES is unsupported and the device has an ATA
* Information VPD page (SAT).
*/
- if (!scsi_get_vpd_page(sdev, 0x89, buffer, vpd_buf_len))
+ rcu_read_lock();
+ vpd = rcu_dereference(sdev->vpd_pg89);
+ if (vpd)
sdev->no_write_same = 1;
+ rcu_read_unlock();
}
if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME_16) == 1)