Skip to content

Commit

Permalink
scsi: sd: Use cached ATA Information VPD page
Browse files Browse the repository at this point in the history
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/[email protected]
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
martinkpetersen committed May 2, 2022
1 parent d657700 commit e38d9e8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2996,17 +2996,19 @@ 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;

/* Disable WRITE SAME if REPORT SUPPORTED OPERATION
* 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)
Expand Down

0 comments on commit e38d9e8

Please sign in to comment.