aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_dbf.c
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2009-08-18 09:43:09 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 09:49:10 -0400
commit2e261af84cdb6a6008a9c361443e35ea646ec683 (patch)
treea17d7de8aa4d57de11117ba194e7b1ac22b59c56 /drivers/s390/scsi/zfcp_dbf.c
parentdcd20e2316cdc333dfdee09649dbe3642eb30e75 (diff)
[SCSI] zfcp: Only collect FSF/HBA debug data for matching trace levels
The default trace level is to only trace failed FSF commands. Thus it is not necessary to collect trace data for most FSF commands, since it will be thrown away later. Restructure the FSF/HBA trace infrastructure to first check the trace level in a inline function and only do the expensive data collection for matching trace levels. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 61776d490d13..5568440ec2fc 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -120,14 +120,10 @@ static int zfcp_dbf_view_header(debug_info_t *id, struct debug_view *view,
120 return p - out_buf; 120 return p - out_buf;
121} 121}
122 122
123/** 123void _zfcp_hba_dbf_event_fsf_response(const char *tag2, int level,
124 * zfcp_hba_dbf_event_fsf_response - trace event for request completion 124 struct zfcp_fsf_req *fsf_req,
125 * @fsf_req: request that has been completed 125 struct zfcp_dbf *dbf)
126 */
127void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
128{ 126{
129 struct zfcp_adapter *adapter = fsf_req->adapter;
130 struct zfcp_dbf *dbf = adapter->dbf;
131 struct fsf_qtcb *qtcb = fsf_req->qtcb; 127 struct fsf_qtcb *qtcb = fsf_req->qtcb;
132 union fsf_prot_status_qual *prot_status_qual = 128 union fsf_prot_status_qual *prot_status_qual =
133 &qtcb->prefix.prot_status_qual; 129 &qtcb->prefix.prot_status_qual;
@@ -138,31 +134,12 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
138 struct zfcp_send_els *send_els; 134 struct zfcp_send_els *send_els;
139 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf; 135 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
140 struct zfcp_hba_dbf_record_response *response = &rec->u.response; 136 struct zfcp_hba_dbf_record_response *response = &rec->u.response;
141 int level;
142 unsigned long flags; 137 unsigned long flags;
143 138
144 spin_lock_irqsave(&dbf->hba_dbf_lock, flags); 139 spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
145 memset(rec, 0, sizeof(*rec)); 140 memset(rec, 0, sizeof(*rec));
146 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); 141 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
147 142 strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE);
148 if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
149 (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
150 strncpy(rec->tag2, "perr", ZFCP_DBF_TAG_SIZE);
151 level = 1;
152 } else if (qtcb->header.fsf_status != FSF_GOOD) {
153 strncpy(rec->tag2, "ferr", ZFCP_DBF_TAG_SIZE);
154 level = 1;
155 } else if ((fsf_req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
156 (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) {
157 strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE);
158 level = 4;
159 } else if (qtcb->header.log_length) {
160 strncpy(rec->tag2, "qtcb", ZFCP_DBF_TAG_SIZE);
161 level = 5;
162 } else {
163 strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE);
164 level = 6;
165 }
166 143
167 response->fsf_command = fsf_req->fsf_command; 144 response->fsf_command = fsf_req->fsf_command;
168 response->fsf_reqid = fsf_req->req_id; 145 response->fsf_reqid = fsf_req->req_id;
@@ -241,14 +218,9 @@ void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
241 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags); 218 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
242} 219}
243 220
244/** 221void _zfcp_hba_dbf_event_fsf_unsol(const char *tag, int level,
245 * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer 222 struct zfcp_adapter *adapter,
246 * @tag: tag indicating which kind of unsolicited status has been received 223 struct fsf_status_read_buffer *status_buffer)
247 * @adapter: adapter that has issued the unsolicited status buffer
248 * @status_buffer: buffer containing payload of unsolicited status
249 */
250void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
251 struct fsf_status_read_buffer *status_buffer)
252{ 224{
253 struct zfcp_dbf *dbf = adapter->dbf; 225 struct zfcp_dbf *dbf = adapter->dbf;
254 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf; 226 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
@@ -296,7 +268,7 @@ void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
296 &status_buffer->payload, rec->u.status.payload_size); 268 &status_buffer->payload, rec->u.status.payload_size);
297 } 269 }
298 270
299 debug_event(dbf->hba_dbf, 2, rec, sizeof(*rec)); 271 debug_event(dbf->hba_dbf, level, rec, sizeof(*rec));
300 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags); 272 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
301} 273}
302 274