]>
Commit | Line | Data |
---|---|---|
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> | |
2 | Subject: [PATCH] zfcp: Only collect SCSI debug data for matching trace levels | |
3 | References: bnc#532063,LTC#55526 | |
4 | ||
5 | From: Christof Schmitt <christof.schmitt@de.ibm.com> | |
6 | ||
7 | The default trace level is to only trace failed SCSI commands. Thus it | |
8 | is not necessary to collect trace data for most SCSI commands, since | |
9 | it will be thrown away later. Restructure the SCSI trace | |
10 | infrastructure to first check the trace level in a inline function and | |
11 | only do the expensive data collection for matching trace levels. | |
12 | ||
13 | Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> | |
14 | ||
15 | Acked-by: John Jolly <jjolly@suse.de> | |
16 | --- | |
17 | ||
18 | drivers/s390/scsi/zfcp_dbf.c | 58 ++------------------------------------ | |
19 | drivers/s390/scsi/zfcp_dbf.h | 63 ++++++++++++++++++++++++++++++++++++++++++ | |
20 | drivers/s390/scsi/zfcp_ext.h | 11 ++----- | |
21 | drivers/s390/scsi/zfcp_fsf.c | 1 | |
22 | drivers/s390/scsi/zfcp_scsi.c | 3 +- | |
23 | 5 files changed, 73 insertions(+), 63 deletions(-) | |
24 | ||
25 | Index: linux-sles11/drivers/s390/scsi/zfcp_dbf.c | |
26 | =================================================================== | |
27 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_dbf.c 2009-08-17 15:31:35.000000000 +0200 | |
28 | +++ linux-sles11/drivers/s390/scsi/zfcp_dbf.c 2009-08-17 15:31:41.000000000 +0200 | |
29 | @@ -1073,13 +1073,11 @@ | |
30 | NULL | |
31 | }; | |
32 | ||
33 | -static void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | |
34 | - struct zfcp_adapter *adapter, | |
35 | - struct scsi_cmnd *scsi_cmnd, | |
36 | - struct zfcp_fsf_req *fsf_req, | |
37 | - unsigned long old_req_id) | |
38 | +void _zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | |
39 | + struct zfcp_dbf *dbf, struct scsi_cmnd *scsi_cmnd, | |
40 | + struct zfcp_fsf_req *fsf_req, | |
41 | + unsigned long old_req_id) | |
42 | { | |
43 | - struct zfcp_dbf *dbf = adapter->dbf; | |
44 | struct zfcp_scsi_dbf_record *rec = &dbf->scsi_dbf_buf; | |
45 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | |
46 | unsigned long flags; | |
47 | @@ -1151,54 +1149,6 @@ | |
48 | spin_unlock_irqrestore(&dbf->scsi_dbf_lock, flags); | |
49 | } | |
50 | ||
51 | -/** | |
52 | - * zfcp_scsi_dbf_event_result - trace event for SCSI command completion | |
53 | - * @tag: tag indicating success or failure of SCSI command | |
54 | - * @level: trace level applicable for this event | |
55 | - * @adapter: adapter that has been used to issue the SCSI command | |
56 | - * @scsi_cmnd: SCSI command pointer | |
57 | - * @fsf_req: request used to issue SCSI command (might be NULL) | |
58 | - */ | |
59 | -void zfcp_scsi_dbf_event_result(const char *tag, int level, | |
60 | - struct zfcp_adapter *adapter, | |
61 | - struct scsi_cmnd *scsi_cmnd, | |
62 | - struct zfcp_fsf_req *fsf_req) | |
63 | -{ | |
64 | - zfcp_scsi_dbf_event("rslt", tag, level, adapter, scsi_cmnd, fsf_req, 0); | |
65 | -} | |
66 | - | |
67 | -/** | |
68 | - * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort | |
69 | - * @tag: tag indicating success or failure of abort operation | |
70 | - * @adapter: adapter thas has been used to issue SCSI command to be aborted | |
71 | - * @scsi_cmnd: SCSI command to be aborted | |
72 | - * @new_fsf_req: request containing abort (might be NULL) | |
73 | - * @old_req_id: identifier of request containg SCSI command to be aborted | |
74 | - */ | |
75 | -void zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | |
76 | - struct scsi_cmnd *scsi_cmnd, | |
77 | - struct zfcp_fsf_req *new_fsf_req, | |
78 | - unsigned long old_req_id) | |
79 | -{ | |
80 | - zfcp_scsi_dbf_event("abrt", tag, 1, adapter, scsi_cmnd, new_fsf_req, | |
81 | - old_req_id); | |
82 | -} | |
83 | - | |
84 | -/** | |
85 | - * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset | |
86 | - * @tag: tag indicating success or failure of reset operation | |
87 | - * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | |
88 | - * @unit: unit that needs reset | |
89 | - * @scsi_cmnd: SCSI command which caused this error recovery | |
90 | - */ | |
91 | -void zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, | |
92 | - struct zfcp_unit *unit, | |
93 | - struct scsi_cmnd *scsi_cmnd) | |
94 | -{ | |
95 | - zfcp_scsi_dbf_event(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, | |
96 | - unit->port->adapter, scsi_cmnd, NULL, 0); | |
97 | -} | |
98 | - | |
99 | static int zfcp_scsi_dbf_view_format(debug_info_t *id, struct debug_view *view, | |
100 | char *out_buf, const char *in_buf) | |
101 | { | |
102 | Index: linux-sles11/drivers/s390/scsi/zfcp_dbf.h | |
103 | =================================================================== | |
104 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_dbf.h 2009-08-17 15:31:35.000000000 +0200 | |
105 | +++ linux-sles11/drivers/s390/scsi/zfcp_dbf.h 2009-08-17 15:31:41.000000000 +0200 | |
106 | @@ -22,7 +22,9 @@ | |
107 | #ifndef ZFCP_DBF_H | |
108 | #define ZFCP_DBF_H | |
109 | ||
110 | +#include "zfcp_ext.h" | |
111 | #include "zfcp_fsf.h" | |
112 | +#include "zfcp_def.h" | |
113 | ||
114 | #define ZFCP_DBF_TAG_SIZE 4 | |
115 | ||
116 | @@ -236,4 +238,65 @@ | |
117 | struct zfcp_scsi_dbf_record scsi_dbf_buf; | |
118 | }; | |
119 | ||
120 | +static inline | |
121 | +void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level, | |
122 | + struct zfcp_adapter *adapter, struct scsi_cmnd *scmd, | |
123 | + struct zfcp_fsf_req *req, unsigned long old_id) | |
124 | +{ | |
125 | + struct zfcp_dbf *dbf = adapter->dbf; | |
126 | + | |
127 | + if (level <= dbf->scsi_dbf->level) | |
128 | + _zfcp_scsi_dbf_event(tag, tag2, level, dbf, scmd, req, old_id); | |
129 | +} | |
130 | + | |
131 | +/** | |
132 | + * zfcp_scsi_dbf_event_result - trace event for SCSI command completion | |
133 | + * @tag: tag indicating success or failure of SCSI command | |
134 | + * @level: trace level applicable for this event | |
135 | + * @adapter: adapter that has been used to issue the SCSI command | |
136 | + * @scmd: SCSI command pointer | |
137 | + * @fsf_req: request used to issue SCSI command (might be NULL) | |
138 | + */ | |
139 | +static inline | |
140 | +void zfcp_scsi_dbf_event_result(const char *tag, int level, | |
141 | + struct zfcp_adapter *adapter, | |
142 | + struct scsi_cmnd *scmd, | |
143 | + struct zfcp_fsf_req *fsf_req) | |
144 | +{ | |
145 | + zfcp_scsi_dbf_event("rslt", tag, level, adapter, scmd, fsf_req, 0); | |
146 | +} | |
147 | + | |
148 | +/** | |
149 | + * zfcp_scsi_dbf_event_abort - trace event for SCSI command abort | |
150 | + * @tag: tag indicating success or failure of abort operation | |
151 | + * @adapter: adapter thas has been used to issue SCSI command to be aborted | |
152 | + * @scmd: SCSI command to be aborted | |
153 | + * @new_req: request containing abort (might be NULL) | |
154 | + * @old_id: identifier of request containg SCSI command to be aborted | |
155 | + */ | |
156 | +static inline | |
157 | +void zfcp_scsi_dbf_event_abort(const char *tag, struct zfcp_adapter *adapter, | |
158 | + struct scsi_cmnd *scmd, | |
159 | + struct zfcp_fsf_req *new_req, | |
160 | + unsigned long old_id) | |
161 | +{ | |
162 | + zfcp_scsi_dbf_event("abrt", tag, 1, adapter, scmd, new_req, old_id); | |
163 | +} | |
164 | + | |
165 | +/** | |
166 | + * zfcp_scsi_dbf_event_devreset - trace event for Logical Unit or Target Reset | |
167 | + * @tag: tag indicating success or failure of reset operation | |
168 | + * @flag: indicates type of reset (Target Reset, Logical Unit Reset) | |
169 | + * @unit: unit that needs reset | |
170 | + * @scsi_cmnd: SCSI command which caused this error recovery | |
171 | + */ | |
172 | +static inline | |
173 | +void zfcp_scsi_dbf_event_devreset(const char *tag, u8 flag, | |
174 | + struct zfcp_unit *unit, | |
175 | + struct scsi_cmnd *scsi_cmnd) | |
176 | +{ | |
177 | + zfcp_scsi_dbf_event(flag == FCP_TARGET_RESET ? "trst" : "lrst", tag, 1, | |
178 | + unit->port->adapter, scsi_cmnd, NULL, 0); | |
179 | +} | |
180 | + | |
181 | #endif /* ZFCP_DBF_H */ | |
182 | Index: linux-sles11/drivers/s390/scsi/zfcp_ext.h | |
183 | =================================================================== | |
184 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_ext.h 2009-08-17 14:29:54.000000000 +0200 | |
185 | +++ linux-sles11/drivers/s390/scsi/zfcp_ext.h 2009-08-17 15:31:41.000000000 +0200 | |
186 | @@ -56,14 +56,9 @@ | |
187 | extern void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *); | |
188 | extern void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *); | |
189 | extern void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *); | |
190 | -extern void zfcp_scsi_dbf_event_result(const char *, int, struct zfcp_adapter *, | |
191 | - struct scsi_cmnd *, | |
192 | - struct zfcp_fsf_req *); | |
193 | -extern void zfcp_scsi_dbf_event_abort(const char *, struct zfcp_adapter *, | |
194 | - struct scsi_cmnd *, struct zfcp_fsf_req *, | |
195 | - unsigned long); | |
196 | -extern void zfcp_scsi_dbf_event_devreset(const char *, u8, struct zfcp_unit *, | |
197 | - struct scsi_cmnd *); | |
198 | +extern void _zfcp_scsi_dbf_event(const char *, const char *, int, | |
199 | + struct zfcp_dbf *, struct scsi_cmnd *, | |
200 | + struct zfcp_fsf_req *, unsigned long); | |
201 | ||
202 | /* zfcp_erp.c */ | |
203 | extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u8, void *, | |
204 | Index: linux-sles11/drivers/s390/scsi/zfcp_fsf.c | |
205 | =================================================================== | |
206 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_fsf.c 2009-08-17 14:29:54.000000000 +0200 | |
207 | +++ linux-sles11/drivers/s390/scsi/zfcp_fsf.c 2009-08-17 15:31:41.000000000 +0200 | |
208 | @@ -10,6 +10,7 @@ | |
209 | ||
210 | #include <linux/blktrace_api.h> | |
211 | #include "zfcp_ext.h" | |
212 | +#include "zfcp_dbf.h" | |
213 | ||
214 | #define ZFCP_REQ_AUTO_CLEANUP 0x00000002 | |
215 | #define ZFCP_REQ_NO_QTCB 0x00000008 | |
216 | Index: linux-sles11/drivers/s390/scsi/zfcp_scsi.c | |
217 | =================================================================== | |
218 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_scsi.c 2009-08-17 14:29:54.000000000 +0200 | |
219 | +++ linux-sles11/drivers/s390/scsi/zfcp_scsi.c 2009-08-17 15:31:41.000000000 +0200 | |
220 | @@ -8,8 +8,9 @@ | |
221 | ||
222 | #define KMSG_COMPONENT "zfcp" | |
223 | ||
224 | -#include "zfcp_ext.h" | |
225 | #include <asm/atomic.h> | |
226 | +#include "zfcp_ext.h" | |
227 | +#include "zfcp_dbf.h" | |
228 | ||
229 | static unsigned int default_depth = 32; | |
230 | module_param_named(queue_depth, default_depth, uint, 0600); |