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 | |
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')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 58 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.h | 63 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 11 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 1 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_scsi.c | 3 |
5 files changed, 73 insertions, 63 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 995e6128b6c9..61776d490d13 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -921,13 +921,11 @@ static struct debug_view zfcp_san_dbf_view = { | |||
921 | NULL | 921 | NULL |
922 | }; | 922 | }; |
923 | 923 | ||
924 | static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | 924 | void _zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, |
925 | struct zfcp_adapter *adapter, | 925 | struct zfcp_dbf *dbf, struct scsi_cmnd *scsi_cmnd, |
926 | struct scsi_cmnd *scsi_cmnd, | 926 | struct zfcp_fsf_req *fsf_req, |
927 | struct zfcp_fsf_req *fsf_req, | 927 | unsigned long old_req_id) |
928 | unsigned long old_req_id) | ||
929 | { | 928 | { |
930 | struct zfcp_dbf *dbf = adapter->dbf; | ||
931 | struct zfcp_scsi_dbf_record *rec = &dbf->scsi_dbf_buf; | 929 | struct zfcp_scsi_dbf_record *rec = &dbf->scsi_dbf_buf; |
932 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | 930 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; |
933 | unsigned long flags; | 931 | unsigned long flags; |
@@ -999,54 +997,6 @@ static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | |||
999 | spin_unlock_irqrestore(&dbf->scsi_dbf_lock, flags); | 997 | spin_unlock_irqrestore(&dbf->scsi_dbf_lock, flags); |
1000 | } | 998 | } |
1001 | 999 | ||
1002 | /** | ||
1003 | * zfcp_scsi_dbf_event_result - trace event for SCSI command completion | ||
1004 | * @tag: tag indicating success or failure of SCSI command | ||
1005 | * @level: trace level applicable for this event | ||
1006 | * @adapter: adapter that has been used to issue the SCSI command | ||
1007 | * @scsi_cmnd: SCSI command pointer | ||
1008 | * @fsf_req: request used to issue SCSI command (might be NULL) | ||
1009 | */ | ||
1010 | void zfcp_scsi_dbf_event_result(const char *tag, int level, | ||
1011 | struct zfcp_adapter *adapter, | ||
1012 | struct scsi_cmnd *scsi_cmnd, | ||
1013 | struct zfcp_fsf_req *fsf_req) | ||
1014 | { | ||
1015 | zfcp_scsi_dbf_event("rslt", tag, level, adapter, scsi_cmnd, fsf_req, 0); | ||
1016 | } | ||
1017 | |||
1018 | /** | ||
1019 | * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort | ||
1020 | * @tag: tag indicating success or failure of abort operation | ||
1021 | * @adapter: adapter thas has been used to issue SCSI command to be aborted | ||
1022 | * @scsi_cmnd: SCSI command to be aborted | ||
1023 | * @new_fsf_req: request containing abort (might be NULL) | ||
1024 | * @old_req_id: identifier of request containg SCSI command to be aborted | ||
1025 | */ | ||
1026 | void zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | ||
1027 | struct scsi_cmnd *scsi_cmnd, | ||
1028 | struct zfcp_fsf_req *new_fsf_req, | ||
1029 | unsigned long old_req_id) | ||
1030 | { | ||
1031 | zfcp_scsi_dbf_event("abrt", tag, 1, adapter, scsi_cmnd, new_fsf_req, | ||
1032 | old_req_id); | ||
1033 | } | ||
1034 | |||
1035 | /** | ||
1036 | * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset | ||
1037 | * @tag: tag indicating success or failure of reset operation | ||
1038 | * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | ||
1039 | * @unit: unit that needs reset | ||
1040 | * @scsi_cmnd: SCSI command which caused this error recovery | ||
1041 | */ | ||
1042 | void zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, | ||
1043 | struct zfcp_unit *unit, | ||
1044 | struct scsi_cmnd *scsi_cmnd) | ||
1045 | { | ||
1046 | zfcp_scsi_dbf_event(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, | ||
1047 | unit->port->adapter, scsi_cmnd, NULL, 0); | ||
1048 | } | ||
1049 | |||
1050 | static int zfcp_scsi_dbf_view_format(debug_info_t *id, struct debug_view *view, | 1000 | static int zfcp_scsi_dbf_view_format(debug_info_t *id, struct debug_view *view, |
1051 | char *out_buf, const char *in_buf) | 1001 | char *out_buf, const char *in_buf) |
1052 | { | 1002 | { |
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 */ |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 3044c6010306..28e76f5be1af 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -57,14 +57,9 @@ extern void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *); | |||
57 | extern void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *); | 57 | extern void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *); |
58 | extern void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *); | 58 | extern void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *); |
59 | extern void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *); | 59 | extern void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *); |
60 | extern void zfcp_scsi_dbf_event_result(const char *, int, struct zfcp_adapter *, | 60 | extern void _zfcp_scsi_dbf_event(const char *, const char *, int, |
61 | struct scsi_cmnd *, | 61 | struct zfcp_dbf *, struct scsi_cmnd *, |
62 | struct zfcp_fsf_req *); | 62 | struct zfcp_fsf_req *, unsigned long); |
63 | extern void zfcp_scsi_dbf_event_abort(const char *, struct zfcp_adapter *, | ||
64 | struct scsi_cmnd *, struct zfcp_fsf_req *, | ||
65 | unsigned long); | ||
66 | extern void zfcp_scsi_dbf_event_devreset(const char *, u8, struct zfcp_unit *, | ||
67 | struct scsi_cmnd *); | ||
68 | 63 | ||
69 | /* zfcp_erp.c */ | 64 | /* zfcp_erp.c */ |
70 | extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, char *, | 65 | extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, char *, |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 47795fbf081f..2635216bfd93 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/blktrace_api.h> | 12 | #include <linux/blktrace_api.h> |
13 | #include "zfcp_ext.h" | 13 | #include "zfcp_ext.h" |
14 | #include "zfcp_dbf.h" | ||
14 | 15 | ||
15 | #define ZFCP_REQ_AUTO_CLEANUP 0x00000002 | 16 | #define ZFCP_REQ_AUTO_CLEANUP 0x00000002 |
16 | #define ZFCP_REQ_NO_QTCB 0x00000008 | 17 | #define ZFCP_REQ_NO_QTCB 0x00000008 |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index 54a7a7474aa5..0bd80a90426a 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -9,8 +9,9 @@ | |||
9 | #define KMSG_COMPONENT "zfcp" | 9 | #define KMSG_COMPONENT "zfcp" |
10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt | 10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
11 | 11 | ||
12 | #include "zfcp_ext.h" | ||
13 | #include <asm/atomic.h> | 12 | #include <asm/atomic.h> |
13 | #include "zfcp_ext.h" | ||
14 | #include "zfcp_dbf.h" | ||
14 | 15 | ||
15 | static unsigned int default_depth = 32; | 16 | static unsigned int default_depth = 32; |
16 | module_param_named(queue_depth, default_depth, uint, 0600); | 17 | module_param_named(queue_depth, default_depth, uint, 0600); |