提交 ab72528a 编写于 作者: C Christof Schmitt 提交者: James Bottomley

[SCSI] zfcp: Move scsi result tracing decision to zfcp_dbf.h

Move the decision which trace tag and trace level to use for the scsi
result trace to zfcp_dbf.h. zfcp_dbf_scsi_result is already an inline
function, so move the trace code there, simplifying the response
handling in zfcp_fsf.c.
Reviewed-by: NSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: NChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 615f59e0
...@@ -303,17 +303,31 @@ void zfcp_dbf_scsi(const char *tag, const char *tag2, int level, ...@@ -303,17 +303,31 @@ void zfcp_dbf_scsi(const char *tag, const char *tag2, int level,
/** /**
* zfcp_dbf_scsi_result - trace event for SCSI command completion * zfcp_dbf_scsi_result - trace event for SCSI command completion
* @tag: tag indicating success or failure of SCSI command * @dbf: adapter dbf trace
* @level: trace level applicable for this event
* @adapter: adapter that has been used to issue the SCSI command
* @scmd: SCSI command pointer * @scmd: SCSI command pointer
* @fsf_req: request used to issue SCSI command (might be NULL) * @req: FSF request used to issue SCSI command
*/ */
static inline static inline
void zfcp_dbf_scsi_result(const char *tag, int level, struct zfcp_dbf *dbf, void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd,
struct scsi_cmnd *scmd, struct zfcp_fsf_req *fsf_req) struct zfcp_fsf_req *req)
{ {
zfcp_dbf_scsi("rslt", tag, level, dbf, scmd, fsf_req, 0); if (scmd->result != 0)
zfcp_dbf_scsi("rslt", "erro", 3, dbf, scmd, req, 0);
else if (scmd->retries > 0)
zfcp_dbf_scsi("rslt", "retr", 4, dbf, scmd, req, 0);
else
zfcp_dbf_scsi("rslt", "norm", 6, dbf, scmd, req, 0);
}
/**
* zfcp_dbf_scsi_fail_send - trace event for failure to send SCSI command
* @dbf: adapter dbf trace
* @scmd: SCSI command pointer
*/
static inline
void zfcp_dbf_scsi_fail_send(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd)
{
zfcp_dbf_scsi("rslt", "fail", 4, dbf, scmd, NULL, 0);
} }
/** /**
......
...@@ -2156,12 +2156,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) ...@@ -2156,12 +2156,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
zfcp_fsf_req_trace(req, scpnt); zfcp_fsf_req_trace(req, scpnt);
skip_fsfstatus: skip_fsfstatus:
if (scpnt->result != 0) zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req);
zfcp_dbf_scsi_result("erro", 3, req->adapter->dbf, scpnt, req);
else if (scpnt->retries > 0)
zfcp_dbf_scsi_result("retr", 4, req->adapter->dbf, scpnt, req);
else
zfcp_dbf_scsi_result("norm", 6, req->adapter->dbf, scpnt, req);
scpnt->host_scribble = NULL; scpnt->host_scribble = NULL;
(scpnt->scsi_done) (scpnt); (scpnt->scsi_done) (scpnt);
......
...@@ -62,7 +62,7 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) ...@@ -62,7 +62,7 @@ static void zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
(struct zfcp_adapter *) scpnt->device->host->hostdata[0]; (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
set_host_byte(scpnt, result); set_host_byte(scpnt, result);
zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL); zfcp_dbf_scsi_fail_send(adapter->dbf, scpnt);
scpnt->scsi_done(scpnt); scpnt->scsi_done(scpnt);
} }
...@@ -89,7 +89,7 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt, ...@@ -89,7 +89,7 @@ static int zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
scsi_result = fc_remote_port_chkready(rport); scsi_result = fc_remote_port_chkready(rport);
if (unlikely(scsi_result)) { if (unlikely(scsi_result)) {
scpnt->result = scsi_result; scpnt->result = scsi_result;
zfcp_dbf_scsi_result("fail", 4, adapter->dbf, scpnt, NULL); zfcp_dbf_scsi_fail_send(adapter->dbf, scpnt);
scpnt->scsi_done(scpnt); scpnt->scsi_done(scpnt);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册