public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christof Schmitt <christof.schmitt@de.ibm.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org, linux-s390@vger.kernel.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	Christof Schmitt <christof.schmitt@de.ibm.com>
Subject: [patch 09/11] zfcp: Move scsi result tracing decision to zfcp_dbf.h
Date: Wed, 17 Feb 2010 11:18:57 +0100	[thread overview]
Message-ID: <20100217102019.065027000@de.ibm.com> (raw)
In-Reply-To: 20100217101848.662299000@de.ibm.com

[-- Attachment #1: 709-zfcp-result-tracing.diff --]
[-- Type: text/plain, Size: 3877 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

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: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---

 drivers/s390/scsi/zfcp_dbf.h  |   28 +++++++++++++++++++++-------
 drivers/s390/scsi/zfcp_fsf.c  |    7 +------
 drivers/s390/scsi/zfcp_scsi.c |    4 ++--
 3 files changed, 24 insertions(+), 15 deletions(-)

diff -urpN linux-2.6/drivers/s390/scsi/zfcp_dbf.h linux-2.6-patched/drivers/s390/scsi/zfcp_dbf.h
--- linux-2.6/drivers/s390/scsi/zfcp_dbf.h	2010-02-16 09:43:31.000000000 +0100
+++ linux-2.6-patched/drivers/s390/scsi/zfcp_dbf.h	2010-02-16 09:43:32.000000000 +0100
@@ -303,17 +303,31 @@ void zfcp_dbf_scsi(const char *tag, cons
 
 /**
  * zfcp_dbf_scsi_result - trace event for SCSI command completion
- * @tag: tag indicating success or failure of SCSI command
- * @level: trace level applicable for this event
- * @adapter: adapter that has been used to issue the SCSI command
+ * @dbf: adapter dbf trace
  * @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
-void zfcp_dbf_scsi_result(const char *tag, int level, struct zfcp_dbf *dbf,
-			  struct scsi_cmnd *scmd, struct zfcp_fsf_req *fsf_req)
+void zfcp_dbf_scsi_result(struct zfcp_dbf *dbf, struct scsi_cmnd *scmd,
+			  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);
 }
 
 /**
diff -urpN linux-2.6/drivers/s390/scsi/zfcp_fsf.c linux-2.6-patched/drivers/s390/scsi/zfcp_fsf.c
--- linux-2.6/drivers/s390/scsi/zfcp_fsf.c	2010-02-16 09:43:32.000000000 +0100
+++ linux-2.6-patched/drivers/s390/scsi/zfcp_fsf.c	2010-02-16 09:43:32.000000000 +0100
@@ -2156,12 +2156,7 @@ static void zfcp_fsf_send_fcp_command_ta
 	zfcp_fsf_req_trace(req, scpnt);
 
 skip_fsfstatus:
-	if (scpnt->result != 0)
-		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);
+	zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req);
 
 	scpnt->host_scribble = NULL;
 	(scpnt->scsi_done) (scpnt);
diff -urpN linux-2.6/drivers/s390/scsi/zfcp_scsi.c linux-2.6-patched/drivers/s390/scsi/zfcp_scsi.c
--- linux-2.6/drivers/s390/scsi/zfcp_scsi.c	2010-02-16 09:43:32.000000000 +0100
+++ linux-2.6-patched/drivers/s390/scsi/zfcp_scsi.c	2010-02-16 09:43:32.000000000 +0100
@@ -62,7 +62,7 @@ static void zfcp_scsi_command_fail(struc
 		(struct zfcp_adapter *) scpnt->device->host->hostdata[0];
 
 	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);
 }
 
@@ -89,7 +89,7 @@ static int zfcp_scsi_queuecommand(struct
 	scsi_result = fc_remote_port_chkready(rport);
 	if (unlikely(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);
 		return 0;
 	}


  parent reply	other threads:[~2010-02-17 10:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-17 10:18 [patch 00/11] zfcp updates for 2.6.34 Christof Schmitt
2010-02-17 10:18 ` [patch 01/11] zfcp: Remove function zfcp_reqlist_find_safe Christof Schmitt
2010-02-17 10:18 ` [patch 02/11] zfcp: Move FSF request tracking code to new file Christof Schmitt
2010-02-17 10:18 ` [patch 03/11] zfcp: Remove two FIXME comments Christof Schmitt
2010-02-17 10:18 ` [patch 04/11] zfcp: Remove unused payload field from zfcp_dbf_san_record Christof Schmitt
2010-02-17 10:18 ` [patch 05/11] zfcp: Fix warnings from smatch Christof Schmitt
2010-02-17 10:18 ` [patch 06/11] zfcp: Dont use 0 to indicate invalid LUN in rec trace Christof Schmitt
2010-02-17 10:18 ` [patch 07/11] zfcp: Remove duplicate assignment of req_seq_no Christof Schmitt
2010-02-17 10:18 ` [patch 08/11] zfcp: Rename sysfs_device attribute to dev in zfcp_unit and zfcp_port Christof Schmitt
2010-02-17 10:18 ` Christof Schmitt [this message]
2010-02-17 10:18 ` [patch 10/11] zfcp: Replace FC4 constants with information from exchange port Christof Schmitt
2010-02-17 10:18 ` [patch 11/11] zfcp: Introduce header file for qdio structs and inline functions Christof Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100217102019.065027000@de.ibm.com \
    --to=christof.schmitt@de.ibm.com \
    --cc=James.Bottomley@suse.de \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox