aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
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
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')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c44
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h53
-rw-r--r--drivers/s390/scsi/zfcp_ext.h9
3 files changed, 67 insertions, 39 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
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index c2d5ef18b73a..bceaff449033 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -240,6 +240,59 @@ struct zfcp_dbf {
240}; 240};
241 241
242static inline 242static inline
243void zfcp_hba_dbf_event_fsf_resp(const char *tag2, int level,
244 struct zfcp_fsf_req *req, struct zfcp_dbf *dbf)
245{
246 if (level <= dbf->hba_dbf->level)
247 _zfcp_hba_dbf_event_fsf_response(tag2, level, req, dbf);
248}
249
250/**
251 * zfcp_hba_dbf_event_fsf_response - trace event for request completion
252 * @fsf_req: request that has been completed
253 */
254static inline void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *req)
255{
256 struct zfcp_dbf *dbf = req->adapter->dbf;
257 struct fsf_qtcb *qtcb = req->qtcb;
258
259 if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
260 (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
261 zfcp_hba_dbf_event_fsf_resp("perr", 1, req, dbf);
262
263 } else if (qtcb->header.fsf_status != FSF_GOOD) {
264 zfcp_hba_dbf_event_fsf_resp("ferr", 1, req, dbf);
265
266 } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
267 (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
268 zfcp_hba_dbf_event_fsf_resp("open", 4, req, dbf);
269
270 } else if (qtcb->header.log_length) {
271 zfcp_hba_dbf_event_fsf_resp("qtcb", 5, req, dbf);
272
273 } else {
274 zfcp_hba_dbf_event_fsf_resp("norm", 6, req, dbf);
275 }
276 }
277
278/**
279 * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer
280 * @tag: tag indicating which kind of unsolicited status has been received
281 * @adapter: adapter that has issued the unsolicited status buffer
282 * @status_buffer: buffer containing payload of unsolicited status
283 */
284static inline
285void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
286 struct fsf_status_read_buffer *buf)
287{
288 struct zfcp_dbf *dbf = adapter->dbf;
289 int level = 2;
290
291 if (level <= dbf->hba_dbf->level)
292 _zfcp_hba_dbf_event_fsf_unsol(tag, level, adapter, buf);
293}
294
295static inline
243void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, 296void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
244 struct zfcp_adapter *adapter, struct scsi_cmnd *scmd, 297 struct zfcp_adapter *adapter, struct scsi_cmnd *scmd,
245 struct zfcp_fsf_req *req, unsigned long old_id) 298 struct zfcp_fsf_req *req, unsigned long old_id)
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 28e76f5be1af..eeed322f32d0 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -45,9 +45,12 @@ extern void zfcp_rec_dbf_event_trigger(char *, void *, u8, u8, void *,
45 struct zfcp_adapter *, 45 struct zfcp_adapter *,
46 struct zfcp_port *, struct zfcp_unit *); 46 struct zfcp_port *, struct zfcp_unit *);
47extern void zfcp_rec_dbf_event_action(char *, struct zfcp_erp_action *); 47extern void zfcp_rec_dbf_event_action(char *, struct zfcp_erp_action *);
48extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *); 48extern void _zfcp_hba_dbf_event_fsf_response(const char *, int level,
49extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *, 49 struct zfcp_fsf_req *,
50 struct fsf_status_read_buffer *); 50 struct zfcp_dbf *dbf);
51extern void _zfcp_hba_dbf_event_fsf_unsol(const char *, int level,
52 struct zfcp_adapter *,
53 struct fsf_status_read_buffer *);
51extern void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *, unsigned int, int, 54extern void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *, unsigned int, int,
52 int); 55 int);
53extern void zfcp_hba_dbf_event_berr(struct zfcp_adapter *, 56extern void zfcp_hba_dbf_event_berr(struct zfcp_adapter *,