[PATCH v2 04/35] scsi: Add scsi_failure field to scsi_exec_args

Mike Christie
2022-09-29T02:54:43Z

Allow SCSI execution callers to pass in a list of failures they want
retried.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
drivers/scsi/scsi_lib.c | 1 +
include/scsi/scsi_device.h | 2 ++
2 files changed, 3 insertions(+)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 18cdcefc7f47..e1c19fea24e0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -215,6 +215,7 @@ int __scsi_exec_req(struct scsi_exec_args *args)
scmd->cmd_len = COMMAND_SIZE(args->cmd[0]);
memcpy(scmd->cmnd, args->cmd, scmd->cmd_len);
scmd->allowed = args->retries;
+ scmd->failures = args->failures;
req->timeout = args->timeout;
req->cmd_flags |= args->op_flags;
req->rq_flags |= args->req_flags | RQF_QUIET;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 44e5986b8ab0..d623d3e62f92 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -14,6 +14,7 @@ struct bsg_device;
struct device;
struct request_queue;
struct scsi_cmnd;
+struct scsi_failure;
struct scsi_lun;
struct scsi_sense_hdr;

@@ -469,6 +470,7 @@ struct scsi_exec_args {
blk_opf_t op_flags; /* flags for ->cmd_flags */
req_flags_t req_flags; /* flags for ->rq_flags */
int *resid; /* optional residual length */
+ struct scsi_failure *failures; /* optional failures to retry */
};

extern int __scsi_exec_req(struct scsi_exec_args *args);
--
2.25.1