diff options
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 281 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.h | 100 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 31 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 12 |
4 files changed, 139 insertions, 285 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index 2cdd6b28ff7f..675503628cc9 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -50,11 +50,6 @@ static void zfcp_dbf_tag(char **p, const char *label, const char *tag) | |||
50 | *p += sprintf(*p, "\n"); | 50 | *p += sprintf(*p, "\n"); |
51 | } | 51 | } |
52 | 52 | ||
53 | static void zfcp_dbf_outs(char **buf, const char *s1, const char *s2) | ||
54 | { | ||
55 | *buf += sprintf(*buf, "%-24s%s\n", s1, s2); | ||
56 | } | ||
57 | |||
58 | static void zfcp_dbf_out(char **buf, const char *s, const char *format, ...) | 53 | static void zfcp_dbf_out(char **buf, const char *s, const char *format, ...) |
59 | { | 54 | { |
60 | va_list arg; | 55 | va_list arg; |
@@ -439,241 +434,96 @@ static struct debug_view zfcp_dbf_hba_view = { | |||
439 | .format_proc = zfcp_dbf_hba_view_format, | 434 | .format_proc = zfcp_dbf_hba_view_format, |
440 | }; | 435 | }; |
441 | 436 | ||
442 | static const char *zfcp_dbf_rec_tags[] = { | 437 | static void zfcp_dbf_set_common(struct zfcp_dbf_rec *rec, |
443 | [ZFCP_REC_DBF_ID_THREAD] = "thread", | 438 | struct zfcp_adapter *adapter, |
444 | [ZFCP_REC_DBF_ID_TARGET] = "target", | 439 | struct zfcp_port *port, |
445 | [ZFCP_REC_DBF_ID_TRIGGER] = "trigger", | 440 | struct scsi_device *sdev) |
446 | [ZFCP_REC_DBF_ID_ACTION] = "action", | ||
447 | }; | ||
448 | |||
449 | static int zfcp_dbf_rec_view_format(debug_info_t *id, struct debug_view *view, | ||
450 | char *buf, const char *_rec) | ||
451 | { | 441 | { |
452 | struct zfcp_dbf_rec_record *r = (struct zfcp_dbf_rec_record *)_rec; | 442 | rec->adapter_status = atomic_read(&adapter->status); |
453 | char *p = buf; | 443 | if (port) { |
454 | char hint[ZFCP_DBF_ID_SIZE + 1]; | 444 | rec->port_status = atomic_read(&port->status); |
455 | 445 | rec->wwpn = port->wwpn; | |
456 | memcpy(hint, r->id2, ZFCP_DBF_ID_SIZE); | 446 | rec->d_id = port->d_id; |
457 | hint[ZFCP_DBF_ID_SIZE] = 0; | 447 | } |
458 | zfcp_dbf_outs(&p, "tag", zfcp_dbf_rec_tags[r->id]); | 448 | if (sdev) { |
459 | zfcp_dbf_outs(&p, "hint", hint); | 449 | rec->lun_status = atomic_read(&sdev_to_zfcp(sdev)->status); |
460 | switch (r->id) { | 450 | rec->lun = zfcp_scsi_dev_lun(sdev); |
461 | case ZFCP_REC_DBF_ID_THREAD: | ||
462 | zfcp_dbf_out(&p, "total", "%d", r->u.thread.total); | ||
463 | zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready); | ||
464 | zfcp_dbf_out(&p, "running", "%d", r->u.thread.running); | ||
465 | break; | ||
466 | case ZFCP_REC_DBF_ID_TARGET: | ||
467 | zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.target.ref); | ||
468 | zfcp_dbf_out(&p, "status", "0x%08x", r->u.target.status); | ||
469 | zfcp_dbf_out(&p, "erp_count", "%d", r->u.target.erp_count); | ||
470 | zfcp_dbf_out(&p, "d_id", "0x%06x", r->u.target.d_id); | ||
471 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.target.wwpn); | ||
472 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.target.fcp_lun); | ||
473 | break; | ||
474 | case ZFCP_REC_DBF_ID_TRIGGER: | ||
475 | zfcp_dbf_out(&p, "reference", "0x%016Lx", r->u.trigger.ref); | ||
476 | zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.trigger.action); | ||
477 | zfcp_dbf_out(&p, "requested", "%d", r->u.trigger.want); | ||
478 | zfcp_dbf_out(&p, "executed", "%d", r->u.trigger.need); | ||
479 | zfcp_dbf_out(&p, "wwpn", "0x%016Lx", r->u.trigger.wwpn); | ||
480 | zfcp_dbf_out(&p, "fcp_lun", "0x%016Lx", r->u.trigger.fcp_lun); | ||
481 | zfcp_dbf_out(&p, "adapter_status", "0x%08x", r->u.trigger.as); | ||
482 | zfcp_dbf_out(&p, "port_status", "0x%08x", r->u.trigger.ps); | ||
483 | zfcp_dbf_out(&p, "lun_status", "0x%08x", r->u.trigger.ls); | ||
484 | break; | ||
485 | case ZFCP_REC_DBF_ID_ACTION: | ||
486 | zfcp_dbf_out(&p, "erp_action", "0x%016Lx", r->u.action.action); | ||
487 | zfcp_dbf_out(&p, "fsf_req", "0x%016Lx", r->u.action.fsf_req); | ||
488 | zfcp_dbf_out(&p, "status", "0x%08Lx", r->u.action.status); | ||
489 | zfcp_dbf_out(&p, "step", "0x%08Lx", r->u.action.step); | ||
490 | break; | ||
491 | } | 451 | } |
492 | p += sprintf(p, "\n"); | ||
493 | return p - buf; | ||
494 | } | 452 | } |
495 | 453 | ||
496 | static struct debug_view zfcp_dbf_rec_view = { | ||
497 | .name = "structured", | ||
498 | .header_proc = zfcp_dbf_view_header, | ||
499 | .format_proc = zfcp_dbf_rec_view_format, | ||
500 | }; | ||
501 | |||
502 | /** | 454 | /** |
503 | * zfcp_dbf_rec_thread - trace event related to recovery thread operation | 455 | * zfcp_dbf_rec_trig - trace event related to triggered recovery |
504 | * @id2: identifier for event | 456 | * @tag: identifier for event |
505 | * @dbf: reference to dbf structure | 457 | * @adapter: adapter on which the erp_action should run |
506 | * This function assumes that the caller is holding erp_lock. | 458 | * @port: remote port involved in the erp_action |
459 | * @sdev: scsi device involved in the erp_action | ||
460 | * @want: wanted erp_action | ||
461 | * @need: required erp_action | ||
462 | * | ||
463 | * The adapter->erp_lock has to be held. | ||
507 | */ | 464 | */ |
508 | void zfcp_dbf_rec_thread(char *id2, struct zfcp_dbf *dbf) | 465 | void zfcp_dbf_rec_trig(char *tag, struct zfcp_adapter *adapter, |
466 | struct zfcp_port *port, struct scsi_device *sdev, | ||
467 | u8 want, u8 need) | ||
509 | { | 468 | { |
510 | struct zfcp_adapter *adapter = dbf->adapter; | 469 | struct zfcp_dbf *dbf = adapter->dbf; |
511 | struct zfcp_dbf_rec_record *r = &dbf->rec_buf; | 470 | struct zfcp_dbf_rec *rec = &dbf->rec_buf; |
512 | unsigned long flags = 0; | ||
513 | struct list_head *entry; | 471 | struct list_head *entry; |
514 | unsigned ready = 0, running = 0, total; | ||
515 | |||
516 | list_for_each(entry, &adapter->erp_ready_head) | ||
517 | ready++; | ||
518 | list_for_each(entry, &adapter->erp_running_head) | ||
519 | running++; | ||
520 | total = adapter->erp_total_count; | ||
521 | |||
522 | spin_lock_irqsave(&dbf->rec_lock, flags); | ||
523 | memset(r, 0, sizeof(*r)); | ||
524 | r->id = ZFCP_REC_DBF_ID_THREAD; | ||
525 | memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); | ||
526 | r->u.thread.total = total; | ||
527 | r->u.thread.ready = ready; | ||
528 | r->u.thread.running = running; | ||
529 | debug_event(dbf->rec, 6, r, sizeof(*r)); | ||
530 | spin_unlock_irqrestore(&dbf->rec_lock, flags); | ||
531 | } | ||
532 | |||
533 | /** | ||
534 | * zfcp_dbf_rec_thread - trace event related to recovery thread operation | ||
535 | * @id2: identifier for event | ||
536 | * @adapter: adapter | ||
537 | * This function assumes that the caller does not hold erp_lock. | ||
538 | */ | ||
539 | void zfcp_dbf_rec_thread_lock(char *id2, struct zfcp_dbf *dbf) | ||
540 | { | ||
541 | struct zfcp_adapter *adapter = dbf->adapter; | ||
542 | unsigned long flags; | ||
543 | |||
544 | read_lock_irqsave(&adapter->erp_lock, flags); | ||
545 | zfcp_dbf_rec_thread(id2, dbf); | ||
546 | read_unlock_irqrestore(&adapter->erp_lock, flags); | ||
547 | } | ||
548 | |||
549 | static void zfcp_dbf_rec_target(char *id2, void *ref, struct zfcp_dbf *dbf, | ||
550 | atomic_t *status, atomic_t *erp_count, u64 wwpn, | ||
551 | u32 d_id, u64 fcp_lun) | ||
552 | { | ||
553 | struct zfcp_dbf_rec_record *r = &dbf->rec_buf; | ||
554 | unsigned long flags; | 472 | unsigned long flags; |
555 | 473 | ||
556 | spin_lock_irqsave(&dbf->rec_lock, flags); | 474 | spin_lock_irqsave(&dbf->rec_lock, flags); |
557 | memset(r, 0, sizeof(*r)); | 475 | memset(rec, 0, sizeof(*rec)); |
558 | r->id = ZFCP_REC_DBF_ID_TARGET; | ||
559 | memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); | ||
560 | r->u.target.ref = (unsigned long)ref; | ||
561 | r->u.target.status = atomic_read(status); | ||
562 | r->u.target.wwpn = wwpn; | ||
563 | r->u.target.d_id = d_id; | ||
564 | r->u.target.fcp_lun = fcp_lun; | ||
565 | r->u.target.erp_count = atomic_read(erp_count); | ||
566 | debug_event(dbf->rec, 3, r, sizeof(*r)); | ||
567 | spin_unlock_irqrestore(&dbf->rec_lock, flags); | ||
568 | } | ||
569 | |||
570 | /** | ||
571 | * zfcp_dbf_rec_adapter - trace event for adapter state change | ||
572 | * @id: identifier for trigger of state change | ||
573 | * @ref: additional reference (e.g. request) | ||
574 | * @dbf: reference to dbf structure | ||
575 | */ | ||
576 | void zfcp_dbf_rec_adapter(char *id, void *ref, struct zfcp_dbf *dbf) | ||
577 | { | ||
578 | struct zfcp_adapter *adapter = dbf->adapter; | ||
579 | 476 | ||
580 | zfcp_dbf_rec_target(id, ref, dbf, &adapter->status, | 477 | rec->id = ZFCP_DBF_REC_TRIG; |
581 | &adapter->erp_counter, 0, 0, | 478 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
582 | ZFCP_DBF_INVALID_LUN); | 479 | zfcp_dbf_set_common(rec, adapter, port, sdev); |
583 | } | ||
584 | 480 | ||
585 | /** | 481 | list_for_each(entry, &adapter->erp_ready_head) |
586 | * zfcp_dbf_rec_port - trace event for port state change | 482 | rec->u.trig.ready++; |
587 | * @id: identifier for trigger of state change | ||
588 | * @ref: additional reference (e.g. request) | ||
589 | * @port: port | ||
590 | */ | ||
591 | void zfcp_dbf_rec_port(char *id, void *ref, struct zfcp_port *port) | ||
592 | { | ||
593 | struct zfcp_dbf *dbf = port->adapter->dbf; | ||
594 | 483 | ||
595 | zfcp_dbf_rec_target(id, ref, dbf, &port->status, | 484 | list_for_each(entry, &adapter->erp_running_head) |
596 | &port->erp_counter, port->wwpn, port->d_id, | 485 | rec->u.trig.running++; |
597 | ZFCP_DBF_INVALID_LUN); | ||
598 | } | ||
599 | 486 | ||
600 | /** | 487 | rec->u.trig.want = want; |
601 | * zfcp_dbf_rec_lun - trace event for LUN state change | 488 | rec->u.trig.need = need; |
602 | * @id: identifier for trigger of state change | ||
603 | * @ref: additional reference (e.g. request) | ||
604 | * @sdev: SCSI device | ||
605 | */ | ||
606 | void zfcp_dbf_rec_lun(char *id, void *ref, struct scsi_device *sdev) | ||
607 | { | ||
608 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | ||
609 | struct zfcp_port *port = zfcp_sdev->port; | ||
610 | struct zfcp_dbf *dbf = port->adapter->dbf; | ||
611 | 489 | ||
612 | zfcp_dbf_rec_target(id, ref, dbf, &zfcp_sdev->status, | 490 | debug_event(dbf->rec, 1, rec, sizeof(*rec)); |
613 | &zfcp_sdev->erp_counter, port->wwpn, port->d_id, | 491 | spin_unlock_irqrestore(&dbf->rec_lock, flags); |
614 | zfcp_scsi_dev_lun(sdev)); | ||
615 | } | 492 | } |
616 | 493 | ||
494 | |||
617 | /** | 495 | /** |
618 | * zfcp_dbf_rec_trigger - trace event for triggered error recovery | 496 | * zfcp_dbf_rec_run - trace event related to running recovery |
619 | * @id2: identifier for error recovery trigger | 497 | * @tag: identifier for event |
620 | * @ref: additional reference (e.g. request) | 498 | * @erp: erp_action running |
621 | * @want: originally requested error recovery action | ||
622 | * @need: error recovery action actually initiated | ||
623 | * @action: address of error recovery action struct | ||
624 | * @adapter: adapter | ||
625 | * @port: port | ||
626 | * @sdev: SCSI device | ||
627 | */ | 499 | */ |
628 | void zfcp_dbf_rec_trigger(char *id2, void *ref, u8 want, u8 need, void *action, | 500 | void zfcp_dbf_rec_run(char *tag, struct zfcp_erp_action *erp) |
629 | struct zfcp_adapter *adapter, struct zfcp_port *port, | ||
630 | struct scsi_device *sdev) | ||
631 | { | 501 | { |
632 | struct zfcp_dbf *dbf = adapter->dbf; | 502 | struct zfcp_dbf *dbf = erp->adapter->dbf; |
633 | struct zfcp_dbf_rec_record *r = &dbf->rec_buf; | 503 | struct zfcp_dbf_rec *rec = &dbf->rec_buf; |
634 | unsigned long flags; | 504 | unsigned long flags; |
635 | 505 | ||
636 | spin_lock_irqsave(&dbf->rec_lock, flags); | 506 | spin_lock_irqsave(&dbf->rec_lock, flags); |
637 | memset(r, 0, sizeof(*r)); | 507 | memset(rec, 0, sizeof(*rec)); |
638 | r->id = ZFCP_REC_DBF_ID_TRIGGER; | ||
639 | memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); | ||
640 | r->u.trigger.ref = (unsigned long)ref; | ||
641 | r->u.trigger.want = want; | ||
642 | r->u.trigger.need = need; | ||
643 | r->u.trigger.action = (unsigned long)action; | ||
644 | r->u.trigger.as = atomic_read(&adapter->status); | ||
645 | if (port) { | ||
646 | r->u.trigger.ps = atomic_read(&port->status); | ||
647 | r->u.trigger.wwpn = port->wwpn; | ||
648 | } | ||
649 | if (sdev) | ||
650 | r->u.trigger.ls = atomic_read(&sdev_to_zfcp(sdev)->status); | ||
651 | r->u.trigger.fcp_lun = sdev ? zfcp_scsi_dev_lun(sdev) : | ||
652 | ZFCP_DBF_INVALID_LUN; | ||
653 | debug_event(dbf->rec, action ? 1 : 4, r, sizeof(*r)); | ||
654 | spin_unlock_irqrestore(&dbf->rec_lock, flags); | ||
655 | } | ||
656 | 508 | ||
657 | /** | 509 | rec->id = ZFCP_DBF_REC_RUN; |
658 | * zfcp_dbf_rec_action - trace event showing progress of recovery action | 510 | memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN); |
659 | * @id2: identifier | 511 | zfcp_dbf_set_common(rec, erp->adapter, erp->port, erp->sdev); |
660 | * @erp_action: error recovery action struct pointer | ||
661 | */ | ||
662 | void zfcp_dbf_rec_action(char *id2, struct zfcp_erp_action *erp_action) | ||
663 | { | ||
664 | struct zfcp_dbf *dbf = erp_action->adapter->dbf; | ||
665 | struct zfcp_dbf_rec_record *r = &dbf->rec_buf; | ||
666 | unsigned long flags; | ||
667 | 512 | ||
668 | spin_lock_irqsave(&dbf->rec_lock, flags); | 513 | rec->u.run.fsf_req_id = erp->fsf_req_id; |
669 | memset(r, 0, sizeof(*r)); | 514 | rec->u.run.rec_status = erp->status; |
670 | r->id = ZFCP_REC_DBF_ID_ACTION; | 515 | rec->u.run.rec_step = erp->step; |
671 | memcpy(r->id2, id2, ZFCP_DBF_ID_SIZE); | 516 | rec->u.run.rec_action = erp->action; |
672 | r->u.action.action = (unsigned long)erp_action; | 517 | |
673 | r->u.action.status = erp_action->status; | 518 | if (erp->sdev) |
674 | r->u.action.step = erp_action->step; | 519 | rec->u.run.rec_count = |
675 | r->u.action.fsf_req = erp_action->fsf_req_id; | 520 | atomic_read(&sdev_to_zfcp(erp->sdev)->erp_counter); |
676 | debug_event(dbf->rec, 5, r, sizeof(*r)); | 521 | else if (erp->port) |
522 | rec->u.run.rec_count = atomic_read(&erp->port->erp_counter); | ||
523 | else | ||
524 | rec->u.run.rec_count = atomic_read(&erp->adapter->erp_counter); | ||
525 | |||
526 | debug_event(dbf->rec, 1, rec, sizeof(*rec)); | ||
677 | spin_unlock_irqrestore(&dbf->rec_lock, flags); | 527 | spin_unlock_irqrestore(&dbf->rec_lock, flags); |
678 | } | 528 | } |
679 | 529 | ||
@@ -1019,8 +869,7 @@ int zfcp_dbf_adapter_register(struct zfcp_adapter *adapter) | |||
1019 | 869 | ||
1020 | /* debug feature area which records recovery activity */ | 870 | /* debug feature area which records recovery activity */ |
1021 | sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev)); | 871 | sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev)); |
1022 | dbf->rec = zfcp_dbf_reg(dbf_name, 3, &zfcp_dbf_rec_view, | 872 | dbf->rec = zfcp_dbf_reg(dbf_name, 3, NULL, sizeof(struct zfcp_dbf_rec)); |
1023 | sizeof(struct zfcp_dbf_rec_record)); | ||
1024 | if (!dbf->rec) | 873 | if (!dbf->rec) |
1025 | goto err_out; | 874 | goto err_out; |
1026 | 875 | ||
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h index 04081b1b62b4..2e823d4ede6e 100644 --- a/drivers/s390/scsi/zfcp_dbf.h +++ b/drivers/s390/scsi/zfcp_dbf.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "zfcp_fsf.h" | 27 | #include "zfcp_fsf.h" |
28 | #include "zfcp_def.h" | 28 | #include "zfcp_def.h" |
29 | 29 | ||
30 | #define ZFCP_DBF_TAG_LEN 7 | ||
30 | #define ZFCP_DBF_TAG_SIZE 4 | 31 | #define ZFCP_DBF_TAG_SIZE 4 |
31 | #define ZFCP_DBF_ID_SIZE 7 | 32 | #define ZFCP_DBF_ID_SIZE 7 |
32 | 33 | ||
@@ -40,57 +41,72 @@ struct zfcp_dbf_dump { | |||
40 | u8 data[]; /* dump data */ | 41 | u8 data[]; /* dump data */ |
41 | } __attribute__ ((packed)); | 42 | } __attribute__ ((packed)); |
42 | 43 | ||
43 | struct zfcp_dbf_rec_record_thread { | 44 | /** |
44 | u32 total; | 45 | * struct zfcp_dbf_rec_trigger - trace record for triggered recovery action |
46 | * @ready: number of ready recovery actions | ||
47 | * @running: number of running recovery actions | ||
48 | * @want: wanted recovery action | ||
49 | * @need: needed recovery action | ||
50 | */ | ||
51 | struct zfcp_dbf_rec_trigger { | ||
45 | u32 ready; | 52 | u32 ready; |
46 | u32 running; | 53 | u32 running; |
47 | }; | ||
48 | |||
49 | struct zfcp_dbf_rec_record_target { | ||
50 | u64 ref; | ||
51 | u32 status; | ||
52 | u32 d_id; | ||
53 | u64 wwpn; | ||
54 | u64 fcp_lun; | ||
55 | u32 erp_count; | ||
56 | }; | ||
57 | |||
58 | struct zfcp_dbf_rec_record_trigger { | ||
59 | u8 want; | 54 | u8 want; |
60 | u8 need; | 55 | u8 need; |
61 | u32 as; | 56 | } __packed; |
62 | u32 ps; | 57 | |
63 | u32 ls; | 58 | /** |
64 | u64 ref; | 59 | * struct zfcp_dbf_rec_running - trace record for running recovery |
65 | u64 action; | 60 | * @fsf_req_id: request id for fsf requests |
66 | u64 wwpn; | 61 | * @rec_status: status of the fsf request |
67 | u64 fcp_lun; | 62 | * @rec_step: current step of the recovery action |
68 | }; | 63 | * rec_count: recovery counter |
64 | */ | ||
65 | struct zfcp_dbf_rec_running { | ||
66 | u64 fsf_req_id; | ||
67 | u32 rec_status; | ||
68 | u16 rec_step; | ||
69 | u8 rec_action; | ||
70 | u8 rec_count; | ||
71 | } __packed; | ||
69 | 72 | ||
70 | struct zfcp_dbf_rec_record_action { | 73 | /** |
71 | u32 status; | 74 | * enum zfcp_dbf_rec_id - recovery trace record id |
72 | u32 step; | 75 | * @ZFCP_DBF_REC_TRIG: triggered recovery identifier |
73 | u64 action; | 76 | * @ZFCP_DBF_REC_RUN: running recovery identifier |
74 | u64 fsf_req; | 77 | */ |
78 | enum zfcp_dbf_rec_id { | ||
79 | ZFCP_DBF_REC_TRIG = 1, | ||
80 | ZFCP_DBF_REC_RUN = 2, | ||
75 | }; | 81 | }; |
76 | 82 | ||
77 | struct zfcp_dbf_rec_record { | 83 | /** |
84 | * struct zfcp_dbf_rec - trace record for error recovery actions | ||
85 | * @id: unique number of recovery record type | ||
86 | * @tag: identifier string specifying the location of initiation | ||
87 | * @lun: logical unit number | ||
88 | * @wwpn: word wide port number | ||
89 | * @d_id: destination ID | ||
90 | * @adapter_status: current status of the adapter | ||
91 | * @port_status: current status of the port | ||
92 | * @lun_status: current status of the lun | ||
93 | * @u.trig: structure zfcp_dbf_rec_trigger | ||
94 | * @u.run: structure zfcp_dbf_rec_running | ||
95 | */ | ||
96 | struct zfcp_dbf_rec { | ||
78 | u8 id; | 97 | u8 id; |
79 | char id2[7]; | 98 | char tag[ZFCP_DBF_TAG_LEN]; |
99 | u64 lun; | ||
100 | u64 wwpn; | ||
101 | u32 d_id; | ||
102 | u32 adapter_status; | ||
103 | u32 port_status; | ||
104 | u32 lun_status; | ||
80 | union { | 105 | union { |
81 | struct zfcp_dbf_rec_record_action action; | 106 | struct zfcp_dbf_rec_trigger trig; |
82 | struct zfcp_dbf_rec_record_thread thread; | 107 | struct zfcp_dbf_rec_running run; |
83 | struct zfcp_dbf_rec_record_target target; | ||
84 | struct zfcp_dbf_rec_record_trigger trigger; | ||
85 | } u; | 108 | } u; |
86 | }; | 109 | } __packed; |
87 | |||
88 | enum { | ||
89 | ZFCP_REC_DBF_ID_ACTION, | ||
90 | ZFCP_REC_DBF_ID_THREAD, | ||
91 | ZFCP_REC_DBF_ID_TARGET, | ||
92 | ZFCP_REC_DBF_ID_TRIGGER, | ||
93 | }; | ||
94 | 110 | ||
95 | struct zfcp_dbf_hba_record_response { | 111 | struct zfcp_dbf_hba_record_response { |
96 | u32 fsf_command; | 112 | u32 fsf_command; |
@@ -232,7 +248,7 @@ struct zfcp_dbf { | |||
232 | spinlock_t hba_lock; | 248 | spinlock_t hba_lock; |
233 | spinlock_t san_lock; | 249 | spinlock_t san_lock; |
234 | spinlock_t scsi_lock; | 250 | spinlock_t scsi_lock; |
235 | struct zfcp_dbf_rec_record rec_buf; | 251 | struct zfcp_dbf_rec rec_buf; |
236 | struct zfcp_dbf_hba_record hba_buf; | 252 | struct zfcp_dbf_hba_record hba_buf; |
237 | struct zfcp_dbf_san_record san_buf; | 253 | struct zfcp_dbf_san_record san_buf; |
238 | struct zfcp_dbf_scsi_record scsi_buf; | 254 | struct zfcp_dbf_scsi_record scsi_buf; |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 0bcd5806bd9a..62b1b4a03ee3 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -76,9 +76,9 @@ static void zfcp_erp_action_ready(struct zfcp_erp_action *act) | |||
76 | struct zfcp_adapter *adapter = act->adapter; | 76 | struct zfcp_adapter *adapter = act->adapter; |
77 | 77 | ||
78 | list_move(&act->list, &act->adapter->erp_ready_head); | 78 | list_move(&act->list, &act->adapter->erp_ready_head); |
79 | zfcp_dbf_rec_action("erardy1", act); | 79 | zfcp_dbf_rec_run("erardy1", act); |
80 | wake_up(&adapter->erp_ready_wq); | 80 | wake_up(&adapter->erp_ready_wq); |
81 | zfcp_dbf_rec_thread("erardy2", adapter->dbf); | 81 | zfcp_dbf_rec_run("erardy2", act); |
82 | } | 82 | } |
83 | 83 | ||
84 | static void zfcp_erp_action_dismiss(struct zfcp_erp_action *act) | 84 | static void zfcp_erp_action_dismiss(struct zfcp_erp_action *act) |
@@ -239,7 +239,7 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, | |||
239 | char *id, void *ref, u32 act_status) | 239 | char *id, void *ref, u32 act_status) |
240 | { | 240 | { |
241 | int retval = 1, need; | 241 | int retval = 1, need; |
242 | struct zfcp_erp_action *act = NULL; | 242 | struct zfcp_erp_action *act; |
243 | 243 | ||
244 | if (!adapter->erp_thread) | 244 | if (!adapter->erp_thread) |
245 | return -EIO; | 245 | return -EIO; |
@@ -255,10 +255,9 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter, | |||
255 | ++adapter->erp_total_count; | 255 | ++adapter->erp_total_count; |
256 | list_add_tail(&act->list, &adapter->erp_ready_head); | 256 | list_add_tail(&act->list, &adapter->erp_ready_head); |
257 | wake_up(&adapter->erp_ready_wq); | 257 | wake_up(&adapter->erp_ready_wq); |
258 | zfcp_dbf_rec_thread("eracte1", adapter->dbf); | ||
259 | retval = 0; | 258 | retval = 0; |
260 | out: | 259 | out: |
261 | zfcp_dbf_rec_trigger(id, ref, want, need, act, adapter, port, sdev); | 260 | zfcp_dbf_rec_trig(id, adapter, port, sdev, want, need); |
262 | return retval; | 261 | return retval; |
263 | } | 262 | } |
264 | 263 | ||
@@ -490,14 +489,14 @@ static int status_change_set(unsigned long mask, atomic_t *status) | |||
490 | static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) | 489 | static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) |
491 | { | 490 | { |
492 | if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) | 491 | if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) |
493 | zfcp_dbf_rec_adapter("eraubl1", NULL, adapter->dbf); | 492 | zfcp_dbf_rec_run("eraubl1", &adapter->erp_action); |
494 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status); | 493 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status); |
495 | } | 494 | } |
496 | 495 | ||
497 | static void zfcp_erp_port_unblock(struct zfcp_port *port) | 496 | static void zfcp_erp_port_unblock(struct zfcp_port *port) |
498 | { | 497 | { |
499 | if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) | 498 | if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status)) |
500 | zfcp_dbf_rec_port("erpubl1", NULL, port); | 499 | zfcp_dbf_rec_run("erpubl1", &port->erp_action); |
501 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status); | 500 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status); |
502 | } | 501 | } |
503 | 502 | ||
@@ -506,14 +505,14 @@ static void zfcp_erp_lun_unblock(struct scsi_device *sdev) | |||
506 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); | 505 | struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); |
507 | 506 | ||
508 | if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status)) | 507 | if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status)) |
509 | zfcp_dbf_rec_lun("erlubl1", NULL, sdev); | 508 | zfcp_dbf_rec_run("erlubl1", &sdev_to_zfcp(sdev)->erp_action); |
510 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status); | 509 | atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status); |
511 | } | 510 | } |
512 | 511 | ||
513 | static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) | 512 | static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) |
514 | { | 513 | { |
515 | list_move(&erp_action->list, &erp_action->adapter->erp_running_head); | 514 | list_move(&erp_action->list, &erp_action->adapter->erp_running_head); |
516 | zfcp_dbf_rec_action("erator1", erp_action); | 515 | zfcp_dbf_rec_run("erator1", erp_action); |
517 | } | 516 | } |
518 | 517 | ||
519 | static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) | 518 | static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) |
@@ -530,11 +529,11 @@ static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *act) | |||
530 | if (act->status & (ZFCP_STATUS_ERP_DISMISSED | | 529 | if (act->status & (ZFCP_STATUS_ERP_DISMISSED | |
531 | ZFCP_STATUS_ERP_TIMEDOUT)) { | 530 | ZFCP_STATUS_ERP_TIMEDOUT)) { |
532 | req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; | 531 | req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; |
533 | zfcp_dbf_rec_action("erscf_1", act); | 532 | zfcp_dbf_rec_run("erscf_1", act); |
534 | req->erp_action = NULL; | 533 | req->erp_action = NULL; |
535 | } | 534 | } |
536 | if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) | 535 | if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) |
537 | zfcp_dbf_rec_action("erscf_2", act); | 536 | zfcp_dbf_rec_run("erscf_2", act); |
538 | if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) | 537 | if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) |
539 | act->fsf_req_id = 0; | 538 | act->fsf_req_id = 0; |
540 | } else | 539 | } else |
@@ -693,10 +692,8 @@ static int zfcp_erp_adapter_strat_fsf_xconf(struct zfcp_erp_action *erp_action) | |||
693 | return ZFCP_ERP_FAILED; | 692 | return ZFCP_ERP_FAILED; |
694 | } | 693 | } |
695 | 694 | ||
696 | zfcp_dbf_rec_thread_lock("erasfx1", adapter->dbf); | ||
697 | wait_event(adapter->erp_ready_wq, | 695 | wait_event(adapter->erp_ready_wq, |
698 | !list_empty(&adapter->erp_ready_head)); | 696 | !list_empty(&adapter->erp_ready_head)); |
699 | zfcp_dbf_rec_thread_lock("erasfx2", adapter->dbf); | ||
700 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) | 697 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) |
701 | break; | 698 | break; |
702 | 699 | ||
@@ -735,10 +732,10 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *act) | |||
735 | if (ret) | 732 | if (ret) |
736 | return ZFCP_ERP_FAILED; | 733 | return ZFCP_ERP_FAILED; |
737 | 734 | ||
738 | zfcp_dbf_rec_thread_lock("erasox1", adapter->dbf); | 735 | zfcp_dbf_rec_run("erasox1", act); |
739 | wait_event(adapter->erp_ready_wq, | 736 | wait_event(adapter->erp_ready_wq, |
740 | !list_empty(&adapter->erp_ready_head)); | 737 | !list_empty(&adapter->erp_ready_head)); |
741 | zfcp_dbf_rec_thread_lock("erasox2", adapter->dbf); | 738 | zfcp_dbf_rec_run("erasox2", act); |
742 | if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) | 739 | if (act->status & ZFCP_STATUS_ERP_TIMEDOUT) |
743 | return ZFCP_ERP_FAILED; | 740 | return ZFCP_ERP_FAILED; |
744 | 741 | ||
@@ -1206,7 +1203,7 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action) | |||
1206 | } | 1203 | } |
1207 | 1204 | ||
1208 | list_del(&erp_action->list); | 1205 | list_del(&erp_action->list); |
1209 | zfcp_dbf_rec_action("eractd1", erp_action); | 1206 | zfcp_dbf_rec_run("eractd1", erp_action); |
1210 | 1207 | ||
1211 | switch (erp_action->action) { | 1208 | switch (erp_action->action) { |
1212 | case ZFCP_ERP_ACTION_REOPEN_LUN: | 1209 | case ZFCP_ERP_ACTION_REOPEN_LUN: |
@@ -1357,11 +1354,9 @@ static int zfcp_erp_thread(void *data) | |||
1357 | unsigned long flags; | 1354 | unsigned long flags; |
1358 | 1355 | ||
1359 | for (;;) { | 1356 | for (;;) { |
1360 | zfcp_dbf_rec_thread_lock("erthrd1", adapter->dbf); | ||
1361 | wait_event_interruptible(adapter->erp_ready_wq, | 1357 | wait_event_interruptible(adapter->erp_ready_wq, |
1362 | !list_empty(&adapter->erp_ready_head) || | 1358 | !list_empty(&adapter->erp_ready_head) || |
1363 | kthread_should_stop()); | 1359 | kthread_should_stop()); |
1364 | zfcp_dbf_rec_thread_lock("erthrd2", adapter->dbf); | ||
1365 | 1360 | ||
1366 | if (kthread_should_stop()) | 1361 | if (kthread_should_stop()) |
1367 | break; | 1362 | break; |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index bf8f3e514839..2d6ee75dfe34 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -46,15 +46,9 @@ extern void zfcp_cfdc_adapter_access_changed(struct zfcp_adapter *); | |||
46 | /* zfcp_dbf.c */ | 46 | /* zfcp_dbf.c */ |
47 | extern int zfcp_dbf_adapter_register(struct zfcp_adapter *); | 47 | extern int zfcp_dbf_adapter_register(struct zfcp_adapter *); |
48 | extern void zfcp_dbf_adapter_unregister(struct zfcp_dbf *); | 48 | extern void zfcp_dbf_adapter_unregister(struct zfcp_dbf *); |
49 | extern void zfcp_dbf_rec_thread(char *, struct zfcp_dbf *); | 49 | extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *, |
50 | extern void zfcp_dbf_rec_thread_lock(char *, struct zfcp_dbf *); | 50 | struct zfcp_port *, struct scsi_device *, u8, u8); |
51 | extern void zfcp_dbf_rec_adapter(char *, void *, struct zfcp_dbf *); | 51 | extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *); |
52 | extern void zfcp_dbf_rec_port(char *, void *, struct zfcp_port *); | ||
53 | extern void zfcp_dbf_rec_lun(char *, void *, struct scsi_device *); | ||
54 | extern void zfcp_dbf_rec_trigger(char *, void *, u8, u8, void *, | ||
55 | struct zfcp_adapter *, struct zfcp_port *, | ||
56 | struct scsi_device *); | ||
57 | extern void zfcp_dbf_rec_action(char *, struct zfcp_erp_action *); | ||
58 | extern void _zfcp_dbf_hba_fsf_response(const char *, int, struct zfcp_fsf_req *, | 52 | extern void _zfcp_dbf_hba_fsf_response(const char *, int, struct zfcp_fsf_req *, |
59 | struct zfcp_dbf *); | 53 | struct zfcp_dbf *); |
60 | extern void _zfcp_dbf_hba_fsf_unsol(const char *, int level, struct zfcp_dbf *, | 54 | extern void _zfcp_dbf_hba_fsf_unsol(const char *, int level, struct zfcp_dbf *, |