ANDROID: scsi: Retry unaligned zoned writes
From ZBC-2: "The device server terminates with CHECK CONDITION status, with the sense key set to ILLEGAL REQUEST, and the additional sense code set to UNALIGNED WRITE COMMAND a write command, other than an entire medium write same command, that specifies: a) the starting LBA in a sequential write required zone set to a value that is not equal to the write pointer for that sequential write required zone; or b) an ending LBA that is not equal to the last logical block within a physical block (see SBC-5)." I am not aware of any other conditions that may trigger the UNALIGNED WRITE COMMAND response. Retry unaligned writes in preparation of removing zone locking. Increase the number of retries for write commands sent to a sequential zone to the maximum number of outstanding commands. Bug: 264714656 Change-Id: If89c1f0b4d382978c52382dd3634f39fc15bcaf0 Signed-off-by: Bart Van Assche <bvanassche@google.com>
This commit is contained in:
@@ -671,6 +671,12 @@ enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd)
|
|||||||
fallthrough;
|
fallthrough;
|
||||||
|
|
||||||
case ILLEGAL_REQUEST:
|
case ILLEGAL_REQUEST:
|
||||||
|
/*
|
||||||
|
* Unaligned write command. Retry immediately to handle
|
||||||
|
* out-of-order zoned writes.
|
||||||
|
*/
|
||||||
|
if (sshdr.asc == 0x21 && sshdr.ascq == 0x04)
|
||||||
|
return NEEDS_RETRY;
|
||||||
if (sshdr.asc == 0x20 || /* Invalid command operation code */
|
if (sshdr.asc == 0x20 || /* Invalid command operation code */
|
||||||
sshdr.asc == 0x21 || /* Logical block address out of range */
|
sshdr.asc == 0x21 || /* Logical block address out of range */
|
||||||
sshdr.asc == 0x22 || /* Invalid function */
|
sshdr.asc == 0x22 || /* Invalid function */
|
||||||
|
|||||||
@@ -1304,6 +1304,9 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
|
|||||||
cmd->transfersize = sdp->sector_size;
|
cmd->transfersize = sdp->sector_size;
|
||||||
cmd->underflow = nr_blocks << 9;
|
cmd->underflow = nr_blocks << 9;
|
||||||
cmd->allowed = sdkp->max_retries;
|
cmd->allowed = sdkp->max_retries;
|
||||||
|
if (blk_queue_pipeline_zoned_writes(rq->q) &&
|
||||||
|
blk_rq_is_seq_zone_write(rq))
|
||||||
|
cmd->allowed += rq->q->nr_requests;
|
||||||
cmd->sdb.length = nr_blocks * sdp->sector_size;
|
cmd->sdb.length = nr_blocks * sdp->sector_size;
|
||||||
|
|
||||||
SCSI_LOG_HLQUEUE(1,
|
SCSI_LOG_HLQUEUE(1,
|
||||||
|
|||||||
Reference in New Issue
Block a user