Skip to content

Commit e38d9e8

Browse files
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>
1 parent d657700 commit e38d9e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/scsi/sd.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,17 +2996,19 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
29962996
}
29972997

29982998
if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, INQUIRY) < 0) {
2999-
/* too large values might cause issues with arcmsr */
3000-
int vpd_buf_len = 64;
2999+
struct scsi_vpd *vpd;
30013000

30023001
sdev->no_report_opcodes = 1;
30033002

30043003
/* Disable WRITE SAME if REPORT SUPPORTED OPERATION
30053004
* CODES is unsupported and the device has an ATA
30063005
* Information VPD page (SAT).
30073006
*/
3008-
if (!scsi_get_vpd_page(sdev, 0x89, buffer, vpd_buf_len))
3007+
rcu_read_lock();
3008+
vpd = rcu_dereference(sdev->vpd_pg89);
3009+
if (vpd)
30093010
sdev->no_write_same = 1;
3011+
rcu_read_unlock();
30103012
}
30113013

30123014
if (scsi_report_opcode(sdev, buffer, SD_BUF_SIZE, WRITE_SAME_16) == 1)

0 commit comments

Comments
 (0)