diff options
author | Christof Schmitt <christof.schmitt@de.ibm.com> | 2009-08-18 09:43:08 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-05 09:49:08 -0400 |
commit | dcd20e2316cdc333dfdee09649dbe3642eb30e75 (patch) | |
tree | fc565dd134841075a215a18ab7622ed8b2ea5c11 /drivers/s390/scsi/zfcp_dbf.h | |
parent | d46f384a89c2378cb7858747faa1935db17e22a8 (diff) |
[SCSI] zfcp: Only collect SCSI debug data for matching trace levels
The default trace level is to only trace failed SCSI commands. Thus it
is not necessary to collect trace data for most SCSI commands since it
will be thrown away later. Restructure the SCSI 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.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h index 4cfd68fe8a26..c2d5ef18b73a 100644 --- a/drivers/s390/scsi/zfcp_dbf.h +++ b/drivers/s390/scsi/zfcp_dbf.h | |||
@@ -22,7 +22,9 @@ | |||
22 | #ifndef ZFCP_DBF_H | 22 | #ifndef ZFCP_DBF_H |
23 | #define ZFCP_DBF_H | 23 | #define ZFCP_DBF_H |
24 | 24 | ||
25 | #include "zfcp_ext.h" | ||
25 | #include "zfcp_fsf.h" | 26 | #include "zfcp_fsf.h" |
27 | #include "zfcp_def.h" | ||
26 | 28 | ||
27 | #define ZFCP_DBF_TAG_SIZE 4 | 29 | #define ZFCP_DBF_TAG_SIZE 4 |
28 | #define ZFCP_DBF_ID_SIZE 7 | 30 | #define ZFCP_DBF_ID_SIZE 7 |
@@ -237,4 +239,65 @@ struct zfcp_dbf { | |||
237 | struct zfcp_scsi_dbf_record scsi_dbf_buf; | 239 | struct zfcp_scsi_dbf_record scsi_dbf_buf; |
238 | }; | 240 | }; |
239 | 241 | ||
242 | static inline | ||
243 | void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | ||
244 | struct zfcp_adapter *adapter, struct scsi_cmnd *scmd, | ||
245 | struct zfcp_fsf_req *req, unsigned long old_id) | ||
246 | { | ||
247 | struct zfcp_dbf *dbf = adapter->dbf; | ||
248 | |||
249 | if (level <= dbf->scsi_dbf->level) | ||
250 | _zfcp_scsi_dbf_event(tag, tag2, level, dbf, scmd, req, old_id); | ||
251 | } | ||
252 | |||
253 | /** | ||
254 | * zfcp_scsi_dbf_event_result - trace event for SCSI command completion | ||
255 | * @tag: tag indicating success or failure of SCSI command | ||
256 | * @level: trace level applicable for this event | ||
257 | * @adapter: adapter that has been used to issue the SCSI command | ||
258 | * @scmd: SCSI command pointer | ||
259 | * @fsf_req: request used to issue SCSI command (might be NULL) | ||
260 | */ | ||
261 | static inline | ||
262 | void zfcp_scsi_dbf_event_result(const char *tag, int level, | ||
263 | struct zfcp_adapter *adapter, | ||
264 | struct scsi_cmnd *scmd, | ||
265 | struct zfcp_fsf_req *fsf_req) | ||
266 | { | ||
267 | zfcp_scsi_dbf_event("rslt", tag, level, adapter, scmd, fsf_req, 0); | ||
268 | } | ||
269 | |||
270 | /** | ||
271 | * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort | ||
272 | * @tag: tag indicating success or failure of abort operation | ||
273 | * @adapter: adapter thas has been used to issue SCSI command to be aborted | ||
274 | * @scmd: SCSI command to be aborted | ||
275 | * @new_req: request containing abort (might be NULL) | ||
276 | * @old_id: identifier of request containg SCSI command to be aborted | ||
277 | */ | ||
278 | static inline | ||
279 | void zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | ||
280 | struct scsi_cmnd *scmd, | ||
281 | struct zfcp_fsf_req *new_req, | ||
282 | unsigned long old_id) | ||
283 | { | ||
284 | zfcp_scsi_dbf_event("abrt", tag, 1, adapter, scmd, new_req, old_id); | ||
285 | } | ||
286 | |||
287 | /** | ||
288 | * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset | ||
289 | * @tag: tag indicating success or failure of reset operation | ||
290 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | ||
291 | * @unit: unit that needs reset | ||
292 | * @scsi_cmnd: SCSI command which caused this error recovery | ||
293 | */ | ||
294 | static inline | ||
295 | void zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, | ||
296 | struct zfcp_unit *unit, | ||
297 | struct scsi_cmnd *scsi_cmnd) | ||
298 | { | ||
299 | zfcp_scsi_dbf_event(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, | ||
300 | unit->port->adapter, scsi_cmnd, NULL, 0); | ||
301 | } | ||
302 | |||
240 | #endif /* ZFCP_DBF_H */ | 303 | #endif /* ZFCP_DBF_H */ |