Commit d46f384a89c2378cb7858747faa1935db17e22a8

Authored by Christof Schmitt
Committed by James Bottomley
1 parent a67417ab7e

[SCSI] zfcp: Move debug data from zfcp_data to own data structure

The struct zfcp_adapter includes everything related to the debug
traces. This introduces dependences between the definitions in
zfcp_def.h and zfcp_dbf.h. Move all debug related data structures to a
new data structure to break those dependencies and manage the debug
data in zfcp_dbf.[hc].

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>

Showing 5 changed files with 143 additions and 113 deletions Side-by-side Diff

drivers/s390/scsi/zfcp_aux.c
... ... @@ -502,10 +502,6 @@
502 502  
503 503 spin_lock_init(&adapter->req_list_lock);
504 504  
505   - spin_lock_init(&adapter->hba_dbf_lock);
506   - spin_lock_init(&adapter->san_dbf_lock);
507   - spin_lock_init(&adapter->scsi_dbf_lock);
508   - spin_lock_init(&adapter->rec_dbf_lock);
509 505 spin_lock_init(&adapter->req_q_lock);
510 506 spin_lock_init(&adapter->qdio_stat_lock);
511 507  
drivers/s390/scsi/zfcp_dbf.c
... ... @@ -3,7 +3,7 @@
3 3 *
4 4 * Debug traces for zfcp.
5 5 *
6   - * Copyright IBM Corporation 2002, 2008
  6 + * Copyright IBM Corporation 2002, 2009
7 7 */
8 8  
9 9 #define KMSG_COMPONENT "zfcp"
... ... @@ -11,6 +11,7 @@
11 11  
12 12 #include <linux/ctype.h>
13 13 #include <asm/debug.h>
  14 +#include "zfcp_dbf.h"
14 15 #include "zfcp_ext.h"
15 16  
16 17 static u32 dbfsize = 4;
... ... @@ -126,6 +127,7 @@
126 127 void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req)
127 128 {
128 129 struct zfcp_adapter *adapter = fsf_req->adapter;
  130 + struct zfcp_dbf *dbf = adapter->dbf;
129 131 struct fsf_qtcb *qtcb = fsf_req->qtcb;
130 132 union fsf_prot_status_qual *prot_status_qual =
131 133 &qtcb->prefix.prot_status_qual;
132 134  
... ... @@ -134,12 +136,12 @@
134 136 struct zfcp_port *port;
135 137 struct zfcp_unit *unit;
136 138 struct zfcp_send_els *send_els;
137   - struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
  139 + struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
138 140 struct zfcp_hba_dbf_record_response *response = &rec->u.response;
139 141 int level;
140 142 unsigned long flags;
141 143  
142   - spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  144 + spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
143 145 memset(rec, 0, sizeof(*rec));
144 146 strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE);
145 147  
... ... @@ -224,7 +226,7 @@
224 226 break;
225 227 }
226 228  
227   - debug_event(adapter->hba_dbf, level, rec, sizeof(*rec));
  229 + debug_event(dbf->hba_dbf, level, rec, sizeof(*rec));
228 230  
229 231 /* have fcp channel microcode fixed to use as little as possible */
230 232 if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) {
231 233  
... ... @@ -232,11 +234,11 @@
232 234 char *buf = (char *)qtcb + qtcb->header.log_start;
233 235 int len = qtcb->header.log_length;
234 236 for (; len && !buf[len - 1]; len--);
235   - zfcp_dbf_hexdump(adapter->hba_dbf, rec, sizeof(*rec), level,
236   - buf, len);
  237 + zfcp_dbf_hexdump(dbf->hba_dbf, rec, sizeof(*rec), level, buf,
  238 + len);
237 239 }
238 240  
239   - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  241 + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
240 242 }
241 243  
242 244 /**
243 245  
... ... @@ -248,10 +250,11 @@
248 250 void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter,
249 251 struct fsf_status_read_buffer *status_buffer)
250 252 {
251   - struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf;
  253 + struct zfcp_dbf *dbf = adapter->dbf;
  254 + struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf;
252 255 unsigned long flags;
253 256  
254   - spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  257 + spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
255 258 memset(rec, 0, sizeof(*rec));
256 259 strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE);
257 260 strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE);
... ... @@ -293,8 +296,8 @@
293 296 &status_buffer->payload, rec->u.status.payload_size);
294 297 }
295 298  
296   - debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec));
297   - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  299 + debug_event(dbf->hba_dbf, 2, rec, sizeof(*rec));
  300 + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
298 301 }
299 302  
300 303 /**
301 304  
302 305  
... ... @@ -308,17 +311,18 @@
308 311 unsigned int qdio_error, int sbal_index,
309 312 int sbal_count)
310 313 {
311   - struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf;
  314 + struct zfcp_dbf *dbf = adapter->dbf;
  315 + struct zfcp_hba_dbf_record *r = &dbf->hba_dbf_buf;
312 316 unsigned long flags;
313 317  
314   - spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  318 + spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
315 319 memset(r, 0, sizeof(*r));
316 320 strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE);
317 321 r->u.qdio.qdio_error = qdio_error;
318 322 r->u.qdio.sbal_index = sbal_index;
319 323 r->u.qdio.sbal_count = sbal_count;
320   - debug_event(adapter->hba_dbf, 0, r, sizeof(*r));
321   - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  324 + debug_event(dbf->hba_dbf, 0, r, sizeof(*r));
  325 + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
322 326 }
323 327  
324 328 /**
325 329  
326 330  
... ... @@ -329,17 +333,18 @@
329 333 void zfcp_hba_dbf_event_berr(struct zfcp_adapter *adapter,
330 334 struct zfcp_fsf_req *req)
331 335 {
332   - struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf;
  336 + struct zfcp_dbf *dbf = adapter->dbf;
  337 + struct zfcp_hba_dbf_record *r = &dbf->hba_dbf_buf;
333 338 struct fsf_status_read_buffer *sr_buf = req->data;
334 339 struct fsf_bit_error_payload *err = &sr_buf->payload.bit_error;
335 340 unsigned long flags;
336 341  
337   - spin_lock_irqsave(&adapter->hba_dbf_lock, flags);
  342 + spin_lock_irqsave(&dbf->hba_dbf_lock, flags);
338 343 memset(r, 0, sizeof(*r));
339 344 strncpy(r->tag, "berr", ZFCP_DBF_TAG_SIZE);
340 345 memcpy(&r->u.berr, err, sizeof(struct fsf_bit_error_payload));
341   - debug_event(adapter->hba_dbf, 0, r, sizeof(*r));
342   - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags);
  346 + debug_event(dbf->hba_dbf, 0, r, sizeof(*r));
  347 + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags);
343 348 }
344 349 static void zfcp_hba_dbf_view_response(char **p,
345 350 struct zfcp_hba_dbf_record_response *r)
... ... @@ -554,7 +559,8 @@
554 559 */
555 560 void zfcp_rec_dbf_event_thread(char *id2, struct zfcp_adapter *adapter)
556 561 {
557   - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
  562 + struct zfcp_dbf *dbf = adapter->dbf;
  563 + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
558 564 unsigned long flags = 0;
559 565 struct list_head *entry;
560 566 unsigned ready = 0, running = 0, total;
561 567  
... ... @@ -565,15 +571,15 @@
565 571 running++;
566 572 total = adapter->erp_total_count;
567 573  
568   - spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
  574 + spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
569 575 memset(r, 0, sizeof(*r));
570 576 r->id = ZFCP_REC_DBF_ID_THREAD;
571 577 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
572 578 r->u.thread.total = total;
573 579 r->u.thread.ready = ready;
574 580 r->u.thread.running = running;
575   - debug_event(adapter->rec_dbf, 6, r, sizeof(*r));
576   - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
  581 + debug_event(dbf->rec_dbf, 6, r, sizeof(*r));
  582 + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
577 583 }
578 584  
579 585 /**
580 586  
... ... @@ -596,10 +602,11 @@
596 602 atomic_t *status, atomic_t *erp_count,
597 603 u64 wwpn, u32 d_id, u64 fcp_lun)
598 604 {
599   - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
  605 + struct zfcp_dbf *dbf = adapter->dbf;
  606 + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
600 607 unsigned long flags;
601 608  
602   - spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
  609 + spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
603 610 memset(r, 0, sizeof(*r));
604 611 r->id = ZFCP_REC_DBF_ID_TARGET;
605 612 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
... ... @@ -609,8 +616,8 @@
609 616 r->u.target.d_id = d_id;
610 617 r->u.target.fcp_lun = fcp_lun;
611 618 r->u.target.erp_count = atomic_read(erp_count);
612   - debug_event(adapter->rec_dbf, 3, r, sizeof(*r));
613   - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
  619 + debug_event(dbf->rec_dbf, 3, r, sizeof(*r));
  620 + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
614 621 }
615 622  
616 623 /**
617 624  
... ... @@ -672,10 +679,11 @@
672 679 void *action, struct zfcp_adapter *adapter,
673 680 struct zfcp_port *port, struct zfcp_unit *unit)
674 681 {
675   - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
  682 + struct zfcp_dbf *dbf = adapter->dbf;
  683 + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
676 684 unsigned long flags;
677 685  
678   - spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
  686 + spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
679 687 memset(r, 0, sizeof(*r));
680 688 r->id = ZFCP_REC_DBF_ID_TRIGGER;
681 689 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
... ... @@ -692,8 +700,8 @@
692 700 r->u.trigger.us = atomic_read(&unit->status);
693 701 r->u.trigger.fcp_lun = unit->fcp_lun;
694 702 }
695   - debug_event(adapter->rec_dbf, action ? 1 : 4, r, sizeof(*r));
696   - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
  703 + debug_event(dbf->rec_dbf, action ? 1 : 4, r, sizeof(*r));
  704 + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
697 705 }
698 706  
699 707 /**
700 708  
... ... @@ -704,10 +712,11 @@
704 712 void zfcp_rec_dbf_event_action(char *id2, struct zfcp_erp_action *erp_action)
705 713 {
706 714 struct zfcp_adapter *adapter = erp_action->adapter;
707   - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
  715 + struct zfcp_dbf *dbf = adapter->dbf;
  716 + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf;
708 717 unsigned long flags;
709 718  
710   - spin_lock_irqsave(&adapter->rec_dbf_lock, flags);
  719 + spin_lock_irqsave(&dbf->rec_dbf_lock, flags);
711 720 memset(r, 0, sizeof(*r));
712 721 r->id = ZFCP_REC_DBF_ID_ACTION;
713 722 memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE);
... ... @@ -715,8 +724,8 @@
715 724 r->u.action.status = erp_action->status;
716 725 r->u.action.step = erp_action->step;
717 726 r->u.action.fsf_req = (unsigned long)erp_action->fsf_req;
718   - debug_event(adapter->rec_dbf, 5, r, sizeof(*r));
719   - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
  727 + debug_event(dbf->rec_dbf, 5, r, sizeof(*r));
  728 + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags);
720 729 }
721 730  
722 731 /**
723 732  
724 733  
... ... @@ -728,13 +737,14 @@
728 737 struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data;
729 738 struct zfcp_wka_port *wka_port = ct->wka_port;
730 739 struct zfcp_adapter *adapter = wka_port->adapter;
  740 + struct zfcp_dbf *dbf = adapter->dbf;
731 741 struct ct_hdr *hdr = sg_virt(ct->req);
732   - struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
  742 + struct zfcp_san_dbf_record *r = &dbf->san_dbf_buf;
733 743 struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req;
734 744 int level = 3;
735 745 unsigned long flags;
736 746  
737   - spin_lock_irqsave(&adapter->san_dbf_lock, flags);
  747 + spin_lock_irqsave(&dbf->san_dbf_lock, flags);
738 748 memset(r, 0, sizeof(*r));
739 749 strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE);
740 750 r->fsf_reqid = fsf_req->req_id;
741 751  
... ... @@ -749,10 +759,10 @@
749 759 oct->max_res_size = hdr->max_res_size;
750 760 oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr),
751 761 ZFCP_DBF_SAN_MAX_PAYLOAD);
752   - debug_event(adapter->san_dbf, level, r, sizeof(*r));
753   - zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level,
  762 + debug_event(dbf->san_dbf, level, r, sizeof(*r));
  763 + zfcp_dbf_hexdump(dbf->san_dbf, r, sizeof(*r), level,
754 764 (void *)hdr + sizeof(struct ct_hdr), oct->len);
755   - spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
  765 + spin_unlock_irqrestore(&dbf->san_dbf_lock, flags);
756 766 }
757 767  
758 768 /**
759 769  
... ... @@ -765,12 +775,13 @@
765 775 struct zfcp_wka_port *wka_port = ct->wka_port;
766 776 struct zfcp_adapter *adapter = wka_port->adapter;
767 777 struct ct_hdr *hdr = sg_virt(ct->resp);
768   - struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf;
  778 + struct zfcp_dbf *dbf = adapter->dbf;
  779 + struct zfcp_san_dbf_record *r = &dbf->san_dbf_buf;
769 780 struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp;
770 781 int level = 3;
771 782 unsigned long flags;
772 783  
773   - spin_lock_irqsave(&adapter->san_dbf_lock, flags);
  784 + spin_lock_irqsave(&dbf->san_dbf_lock, flags);
774 785 memset(r, 0, sizeof(*r));
775 786 strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE);
776 787 r->fsf_reqid = fsf_req->req_id;
777 788  
... ... @@ -785,10 +796,10 @@
785 796 rct->max_res_size = hdr->max_res_size;
786 797 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
787 798 ZFCP_DBF_SAN_MAX_PAYLOAD);
788   - debug_event(adapter->san_dbf, level, r, sizeof(*r));
789   - zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level,
  799 + debug_event(dbf->san_dbf, level, r, sizeof(*r));
  800 + zfcp_dbf_hexdump(dbf->san_dbf, r, sizeof(*r), level,
790 801 (void *)hdr + sizeof(struct ct_hdr), rct->len);
791   - spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
  802 + spin_unlock_irqrestore(&dbf->san_dbf_lock, flags);
792 803 }
793 804  
794 805 static void zfcp_san_dbf_event_els(const char *tag, int level,
795 806  
... ... @@ -797,10 +808,11 @@
797 808 int buflen)
798 809 {
799 810 struct zfcp_adapter *adapter = fsf_req->adapter;
800   - struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf;
  811 + struct zfcp_dbf *dbf = adapter->dbf;
  812 + struct zfcp_san_dbf_record *rec = &dbf->san_dbf_buf;
801 813 unsigned long flags;
802 814  
803   - spin_lock_irqsave(&adapter->san_dbf_lock, flags);
  815 + spin_lock_irqsave(&dbf->san_dbf_lock, flags);
804 816 memset(rec, 0, sizeof(*rec));
805 817 strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE);
806 818 rec->fsf_reqid = fsf_req->req_id;
807 819  
... ... @@ -808,10 +820,10 @@
808 820 rec->s_id = s_id;
809 821 rec->d_id = d_id;
810 822 rec->u.els.ls_code = ls_code;
811   - debug_event(adapter->san_dbf, level, rec, sizeof(*rec));
812   - zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level,
  823 + debug_event(dbf->san_dbf, level, rec, sizeof(*rec));
  824 + zfcp_dbf_hexdump(dbf->san_dbf, rec, sizeof(*rec), level,
813 825 buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD));
814   - spin_unlock_irqrestore(&adapter->san_dbf_lock, flags);
  826 + spin_unlock_irqrestore(&dbf->san_dbf_lock, flags);
815 827 }
816 828  
817 829 /**
818 830  
... ... @@ -915,14 +927,15 @@
915 927 struct zfcp_fsf_req *fsf_req,
916 928 unsigned long old_req_id)
917 929 {
918   - struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf;
  930 + struct zfcp_dbf *dbf = adapter->dbf;
  931 + struct zfcp_scsi_dbf_record *rec = &dbf->scsi_dbf_buf;
919 932 struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec;
920 933 unsigned long flags;
921 934 struct fcp_rsp_iu *fcp_rsp;
922 935 char *fcp_rsp_info = NULL, *fcp_sns_info = NULL;
923 936 int offset = 0, buflen = 0;
924 937  
925   - spin_lock_irqsave(&adapter->scsi_dbf_lock, flags);
  938 + spin_lock_irqsave(&dbf->scsi_dbf_lock, flags);
926 939 do {
927 940 memset(rec, 0, sizeof(*rec));
928 941 if (offset == 0) {
929 942  
... ... @@ -981,9 +994,9 @@
981 994 memcpy(dump->data, fcp_sns_info + offset, dump->size);
982 995 offset += dump->size;
983 996 }
984   - debug_event(adapter->scsi_dbf, level, rec, sizeof(*rec));
  997 + debug_event(dbf->scsi_dbf, level, rec, sizeof(*rec));
985 998 } while (offset < buflen);
986   - spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags);
  999 + spin_unlock_irqrestore(&dbf->scsi_dbf_lock, flags);
987 1000 }
988 1001  
989 1002 /**
... ... @@ -1087,6 +1100,22 @@
1087 1100 NULL
1088 1101 };
1089 1102  
  1103 +static debug_info_t *zfcp_dbf_reg(const char *name, int level,
  1104 + struct debug_view *view, int size)
  1105 +{
  1106 + struct debug_info *d;
  1107 +
  1108 + d = debug_register(name, dbfsize, level, size);
  1109 + if (!d)
  1110 + return NULL;
  1111 +
  1112 + debug_register_view(d, &debug_hex_ascii_view);
  1113 + debug_register_view(d, view);
  1114 + debug_set_level(d, level);
  1115 +
  1116 + return d;
  1117 +}
  1118 +
1090 1119 /**
1091 1120 * zfcp_adapter_debug_register - registers debug feature for an adapter
1092 1121 * @adapter: pointer to adapter for which debug features should be registered
1093 1122  
1094 1123  
1095 1124  
1096 1125  
1097 1126  
1098 1127  
1099 1128  
... ... @@ -1095,52 +1124,56 @@
1095 1124 int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1096 1125 {
1097 1126 char dbf_name[DEBUG_MAX_NAME_LEN];
  1127 + struct zfcp_dbf *dbf;
1098 1128  
  1129 + dbf = kmalloc(sizeof(struct zfcp_dbf), GFP_KERNEL);
  1130 + if (!dbf)
  1131 + return -ENOMEM;
  1132 +
  1133 + spin_lock_init(&dbf->hba_dbf_lock);
  1134 + spin_lock_init(&dbf->san_dbf_lock);
  1135 + spin_lock_init(&dbf->scsi_dbf_lock);
  1136 + spin_lock_init(&dbf->rec_dbf_lock);
  1137 +
1099 1138 /* debug feature area which records recovery activity */
1100 1139 sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev));
1101   - adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1,
1102   - sizeof(struct zfcp_rec_dbf_record));
1103   - if (!adapter->rec_dbf)
1104   - goto failed;
1105   - debug_register_view(adapter->rec_dbf, &debug_hex_ascii_view);
1106   - debug_register_view(adapter->rec_dbf, &zfcp_rec_dbf_view);
1107   - debug_set_level(adapter->rec_dbf, 3);
  1140 + dbf->rec_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_rec_dbf_view,
  1141 + sizeof(struct zfcp_rec_dbf_record));
  1142 + if (!dbf->rec_dbf)
  1143 + goto fail_rec;
1108 1144  
1109 1145 /* debug feature area which records HBA (FSF and QDIO) conditions */
1110 1146 sprintf(dbf_name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev));
1111   - adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1,
1112   - sizeof(struct zfcp_hba_dbf_record));
1113   - if (!adapter->hba_dbf)
1114   - goto failed;
1115   - debug_register_view(adapter->hba_dbf, &debug_hex_ascii_view);
1116   - debug_register_view(adapter->hba_dbf, &zfcp_hba_dbf_view);
1117   - debug_set_level(adapter->hba_dbf, 3);
  1147 + dbf->hba_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_hba_dbf_view,
  1148 + sizeof(struct zfcp_hba_dbf_record));
  1149 + if (!dbf->hba_dbf)
  1150 + goto fail_hba;
1118 1151  
1119 1152 /* debug feature area which records SAN command failures and recovery */
1120 1153 sprintf(dbf_name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev));
1121   - adapter->san_dbf = debug_register(dbf_name, dbfsize, 1,
1122   - sizeof(struct zfcp_san_dbf_record));
1123   - if (!adapter->san_dbf)
1124   - goto failed;
1125   - debug_register_view(adapter->san_dbf, &debug_hex_ascii_view);
1126   - debug_register_view(adapter->san_dbf, &zfcp_san_dbf_view);
1127   - debug_set_level(adapter->san_dbf, 6);
  1154 + dbf->san_dbf = zfcp_dbf_reg(dbf_name, 6, &zfcp_san_dbf_view,
  1155 + sizeof(struct zfcp_san_dbf_record));
  1156 + if (!dbf->san_dbf)
  1157 + goto fail_san;
1128 1158  
1129 1159 /* debug feature area which records SCSI command failures and recovery */
1130 1160 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev));
1131   - adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1,
1132   - sizeof(struct zfcp_scsi_dbf_record));
1133   - if (!adapter->scsi_dbf)
1134   - goto failed;
1135   - debug_register_view(adapter->scsi_dbf, &debug_hex_ascii_view);
1136   - debug_register_view(adapter->scsi_dbf, &zfcp_scsi_dbf_view);
1137   - debug_set_level(adapter->scsi_dbf, 3);
  1161 + dbf->scsi_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_scsi_dbf_view,
  1162 + sizeof(struct zfcp_scsi_dbf_record));
  1163 + if (!dbf->scsi_dbf)
  1164 + goto fail_scsi;
1138 1165  
  1166 + adapter->dbf = dbf;
1139 1167 return 0;
1140 1168  
1141   - failed:
1142   - zfcp_adapter_debug_unregister(adapter);
1143   -
  1169 +fail_scsi:
  1170 + debug_unregister(dbf->san_dbf);
  1171 +fail_san:
  1172 + debug_unregister(dbf->hba_dbf);
  1173 +fail_hba:
  1174 + debug_unregister(dbf->rec_dbf);
  1175 +fail_rec:
  1176 + kfree(dbf);
1144 1177 return -ENOMEM;
1145 1178 }
1146 1179  
... ... @@ -1150,13 +1183,11 @@
1150 1183 */
1151 1184 void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
1152 1185 {
1153   - debug_unregister(adapter->scsi_dbf);
1154   - debug_unregister(adapter->san_dbf);
1155   - debug_unregister(adapter->hba_dbf);
1156   - debug_unregister(adapter->rec_dbf);
1157   - adapter->scsi_dbf = NULL;
1158   - adapter->san_dbf = NULL;
1159   - adapter->hba_dbf = NULL;
1160   - adapter->rec_dbf = NULL;
  1186 + debug_unregister(adapter->dbf->scsi_dbf);
  1187 + debug_unregister(adapter->dbf->san_dbf);
  1188 + debug_unregister(adapter->dbf->hba_dbf);
  1189 + debug_unregister(adapter->dbf->rec_dbf);
  1190 + kfree(adapter->dbf);
  1191 + adapter->dbf = NULL;
1161 1192 }
drivers/s390/scsi/zfcp_dbf.h
... ... @@ -2,7 +2,7 @@
2 2 * This file is part of the zfcp device driver for
3 3 * FCP adapters for IBM System z9 and zSeries.
4 4 *
5   - * Copyright IBM Corp. 2008, 2008
  5 + * Copyright IBM Corp. 2008, 2009
6 6 *
7 7 * This program is free software; you can redistribute it and/or modify
8 8 * it under the terms of the GNU General Public License as published by
... ... @@ -221,6 +221,21 @@
221 221 u32 sns_info_len;
222 222 u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO];
223 223 } __attribute__ ((packed));
  224 +
  225 +struct zfcp_dbf {
  226 + debug_info_t *rec_dbf;
  227 + debug_info_t *hba_dbf;
  228 + debug_info_t *san_dbf;
  229 + debug_info_t *scsi_dbf;
  230 + spinlock_t rec_dbf_lock;
  231 + spinlock_t hba_dbf_lock;
  232 + spinlock_t san_dbf_lock;
  233 + spinlock_t scsi_dbf_lock;
  234 + struct zfcp_rec_dbf_record rec_dbf_buf;
  235 + struct zfcp_hba_dbf_record hba_dbf_buf;
  236 + struct zfcp_san_dbf_record san_dbf_buf;
  237 + struct zfcp_scsi_dbf_record scsi_dbf_buf;
  238 +};
224 239  
225 240 #endif /* ZFCP_DBF_H */
drivers/s390/scsi/zfcp_def.h
... ... @@ -37,10 +37,8 @@
37 37 #include <asm/debug.h>
38 38 #include <asm/ebcdic.h>
39 39 #include <asm/sysinfo.h>
40   -#include "zfcp_dbf.h"
41 40 #include "zfcp_fsf.h"
42 41  
43   -
44 42 /********************* GENERAL DEFINES *********************************/
45 43  
46 44 #define REQUEST_LIST_SIZE 128
... ... @@ -468,18 +466,7 @@
468 466 u32 erp_low_mem_count; /* nr of erp actions waiting
469 467 for memory */
470 468 struct zfcp_wka_ports *gs; /* generic services */
471   - debug_info_t *rec_dbf;
472   - debug_info_t *hba_dbf;
473   - debug_info_t *san_dbf; /* debug feature areas */
474   - debug_info_t *scsi_dbf;
475   - spinlock_t rec_dbf_lock;
476   - spinlock_t hba_dbf_lock;
477   - spinlock_t san_dbf_lock;
478   - spinlock_t scsi_dbf_lock;
479   - struct zfcp_rec_dbf_record rec_dbf_buf;
480   - struct zfcp_hba_dbf_record hba_dbf_buf;
481   - struct zfcp_san_dbf_record san_dbf_buf;
482   - struct zfcp_scsi_dbf_record scsi_dbf_buf;
  469 + struct zfcp_dbf *dbf; /* debug traces */
483 470 struct zfcp_adapter_mempool pool; /* Adapter memory pools */
484 471 struct qdio_initialize qdio_init_data; /* for qdio_establish */
485 472 struct fc_host_statistics *fc_stats;
drivers/s390/scsi/zfcp_fsf.h
... ... @@ -3,13 +3,14 @@
3 3 *
4 4 * Interface to the FSF support functions.
5 5 *
6   - * Copyright IBM Corporation 2002, 2008
  6 + * Copyright IBM Corporation 2002, 2009
7 7 */
8 8  
9 9 #ifndef FSF_H
10 10 #define FSF_H
11 11  
12 12 #include <linux/pfn.h>
  13 +#include <linux/scatterlist.h>
13 14  
14 15 #define FSF_QTCB_CURRENT_VERSION 0x00000001
15 16