]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.arch/s390-17-perf-17-zfcp-fsfhba-trace-only-matching-debug-data.patch
Fix oinkmaster patch.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.arch / s390-17-perf-17-zfcp-fsfhba-trace-only-matching-debug-data.patch
CommitLineData
82094b55
AF
1From: Gerald Schaefer <geraldsc@de.ibm.com>
2Subject: [PATCH] zfcp: Only collect FSF/HBA debug data for matching trace levels
3References: bnc#532063,LTC#55526
4
5From: Christof Schmitt <christof.schmitt@de.ibm.com>
6
7The default trace level is to only trace failed FSF commands. Thus it
8is not necessary to collect trace data for most FSF commands, since
9it will be thrown away later. Restructure the FSF/HBA trace
10infrastructure to first check the trace level in a inline function and
11only do the expensive data collection for matching trace levels.
12
13Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
14
15Acked-by: John Jolly <jjolly@suse.de>
16---
17
18 drivers/s390/scsi/zfcp_dbf.c | 44 ++++++-----------------------------
19 drivers/s390/scsi/zfcp_dbf.h | 53 +++++++++++++++++++++++++++++++++++++++++++
20 drivers/s390/scsi/zfcp_ext.h | 9 ++++---
21 3 files changed, 67 insertions(+), 39 deletions(-)
22
23--- a/drivers/s390/scsi/zfcp_dbf.c 2009-07-01 17:57:03.000000000 +0200
24+++ b/drivers/s390/scsi/zfcp_dbf.c 2009-07-01 17:57:41.000000000 +0200
25@@ -119,14 +119,10 @@ static int zfcp_dbf_view_header(debug_in
26 return p - out_buf;
27 }
28
29-/**
30- * zfcp_hba_dbf_event_fsf_response - trace event for request completion
31- * @fsf_req: request that has been completed
32- */
33-void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
34+void _zfcp_hba_dbf_event_fsf_response(const char *tag2, int level,
35+ struct zfcp_fsf_req *fsf_req,
36+ struct zfcp_dbf *dbf)
37 {
38- struct zfcp_adapter *adapter = fsf_req->adapter;
39- struct zfcp_dbf *dbf = adapter->dbf;
40 struct fsf_qtcb *qtcb = fsf_req->qtcb;
41 union fsf_prot_status_qual *prot_status_qual =
42 &qtcb->prefix.prot_status_qual;
43@@ -137,31 +133,12 @@ void zfcp_hba_dbf_event_fsf_response(str
44 struct zfcp_send_els *send_els;
45 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
46 struct zfcp_hba_dbf_record_response *response = &rec->u.response;
47- int level;
48 unsigned long flags;
49
50 spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
51 memset(rec, 0, sizeof(*rec));
52 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
53-
54- if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
55- (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
56- strncpy(rec->tag2, "perr", ZFCP_DBF_TAG_SIZE);
57- level = 1;
58- } else if (qtcb->header.fsf_status != FSF_GOOD) {
59- strncpy(rec->tag2, "ferr", ZFCP_DBF_TAG_SIZE);
60- level = 1;
61- } else if ((fsf_req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
62- (fsf_req->fsf_command == FSF_QTCB_OPEN_LUN)) {
63- strncpy(rec->tag2, "open", ZFCP_DBF_TAG_SIZE);
64- level = 4;
65- } else if (qtcb->header.log_length) {
66- strncpy(rec->tag2, "qtcb", ZFCP_DBF_TAG_SIZE);
67- level = 5;
68- } else {
69- strncpy(rec->tag2, "norm", ZFCP_DBF_TAG_SIZE);
70- level = 6;
71- }
72+ strncpy(rec->tag2, tag2, ZFCP_DBF_TAG_SIZE);
73
74 response->fsf_command = fsf_req->fsf_command;
75 response->fsf_reqid = (unsigned long)fsf_req;
76@@ -240,14 +217,9 @@ void zfcp_hba_dbf_event_fsf_response(str
77 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
78 }
79
80-/**
81- * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer
82- * @tag: tag indicating which kind of unsolicited status has been received
83- * @adapter: adapter that has issued the unsolicited status buffer
84- * @status_buffer: buffer containing payload of unsolicited status
85- */
86-void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
87- struct fsf_status_read_buffer *status_buffer)
88+void _zfcp_hba_dbf_event_fsf_unsol(const char *tag, int level,
89+ struct zfcp_adapter *adapter,
90+ struct fsf_status_read_buffer *status_buffer)
91 {
92 struct zfcp_dbf *dbf = adapter->dbf;
93 struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
94@@ -295,7 +267,7 @@ void zfcp_hba_dbf_event_fsf_unsol(const
95 &status_buffer->payload, rec->u.status.payload_size);
96 }
97
98- debug_event(dbf->hba_dbf, 2, rec, sizeof(*rec));
99+ debug_event(dbf->hba_dbf, level, rec, sizeof(*rec));
100 spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
101 }
102
103--- a/drivers/s390/scsi/zfcp_dbf.h 2009-07-01 17:57:03.000000000 +0200
104+++ b/drivers/s390/scsi/zfcp_dbf.h 2009-07-01 17:57:41.000000000 +0200
105@@ -239,6 +239,59 @@ struct zfcp_dbf {
106 };
107
108 static inline
109+void zfcp_hba_dbf_event_fsf_resp(const char *tag2, int level,
110+ struct zfcp_fsf_req *req, struct zfcp_dbf *dbf)
111+{
112+ if (level <= dbf->hba_dbf->level)
113+ _zfcp_hba_dbf_event_fsf_response(tag2, level, req, dbf);
114+}
115+
116+/**
117+ * zfcp_hba_dbf_event_fsf_response - trace event for request completion
118+ * @fsf_req: request that has been completed
119+ */
120+static inline void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *req)
121+{
122+ struct zfcp_dbf *dbf = req->adapter->dbf;
123+ struct fsf_qtcb *qtcb = req->qtcb;
124+
125+ if ((qtcb->prefix.prot_status != FSF_PROT_GOOD) &&
126+ (qtcb->prefix.prot_status != FSF_PROT_FSF_STATUS_PRESENTED)) {
127+ zfcp_hba_dbf_event_fsf_resp("perr", 1, req, dbf);
128+
129+ } else if (qtcb->header.fsf_status != FSF_GOOD) {
130+ zfcp_hba_dbf_event_fsf_resp("ferr", 1, req, dbf);
131+
132+ } else if ((req->fsf_command == FSF_QTCB_OPEN_PORT_WITH_DID) ||
133+ (req->fsf_command == FSF_QTCB_OPEN_LUN)) {
134+ zfcp_hba_dbf_event_fsf_resp("open", 4, req, dbf);
135+
136+ } else if (qtcb->header.log_length) {
137+ zfcp_hba_dbf_event_fsf_resp("qtcb", 5, req, dbf);
138+
139+ } else {
140+ zfcp_hba_dbf_event_fsf_resp("norm", 6, req, dbf);
141+ }
142+ }
143+
144+/**
145+ * zfcp_hba_dbf_event_fsf_unsol - trace event for an unsolicited status buffer
146+ * @tag: tag indicating which kind of unsolicited status has been received
147+ * @adapter: adapter that has issued the unsolicited status buffer
148+ * @status_buffer: buffer containing payload of unsolicited status
149+ */
150+static inline
151+void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
152+ struct fsf_status_read_buffer *buf)
153+{
154+ struct zfcp_dbf *dbf = adapter->dbf;
155+ int level = 2;
156+
157+ if (level <= dbf->hba_dbf->level)
158+ _zfcp_hba_dbf_event_fsf_unsol(tag, level, adapter, buf);
159+}
160+
161+static inline
162 void zfcp_scsi_dbf_event(const char *tag, const char *tag2, int level,
163 struct zfcp_adapter *adapter, struct scsi_cmnd *scmd,
164 struct zfcp_fsf_req *req, unsigned long old_id)
165--- a/drivers/s390/scsi/zfcp_ext.h 2009-07-01 17:57:03.000000000 +0200
166+++ b/drivers/s390/scsi/zfcp_ext.h 2009-07-01 17:58:28.000000000 +0200
167@@ -44,9 +44,12 @@ extern void zfcp_rec_dbf_event_trigger(u
168 struct zfcp_adapter *,
169 struct zfcp_port *, struct zfcp_unit *);
170 extern void zfcp_rec_dbf_event_action(u8, struct zfcp_erp_action *);
171-extern void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *);
172-extern void zfcp_hba_dbf_event_fsf_unsol(const char *, struct zfcp_adapter *,
173- struct fsf_status_read_buffer *);
174+extern void _zfcp_hba_dbf_event_fsf_response(const char *, int level,
175+ struct zfcp_fsf_req *,
176+ struct zfcp_dbf *dbf);
177+extern void _zfcp_hba_dbf_event_fsf_unsol(const char *, int level,
178+ struct zfcp_adapter *,
179+ struct fsf_status_read_buffer *);
180 extern void zfcp_hba_dbf_event_qdio(struct zfcp_adapter *, unsigned int, int,
181 int);
182 extern void zfcp_hba_dbf_event_berr(struct zfcp_adapter *,