diff options
author | Martin Peschke <mp3@de.ibm.com> | 2008-03-27 09:22:01 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:19:04 -0400 |
commit | 348447e85749120ad600a5c8e23b6bb7058b931d (patch) | |
tree | c7d524906bf256c113d32783e8bfaecad1d1657c /drivers/s390/scsi/zfcp_dbf.c | |
parent | d79a83dbffe2e49e73f2903c350937faf2e0c2f1 (diff) |
[SCSI] zfcp: Add trace records for recovery thread and its queues
This patch writes trace records which provide information about the
operation of the zfcp error recovery thread and the queues it works
on.
Signed-off-by: Martin Peschke <mp3@de.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_dbf.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_dbf.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c index e7712eb13eea..5a4b1e9a8b50 100644 --- a/drivers/s390/scsi/zfcp_dbf.c +++ b/drivers/s390/scsi/zfcp_dbf.c | |||
@@ -521,9 +521,19 @@ static struct debug_view zfcp_hba_dbf_view = { | |||
521 | }; | 521 | }; |
522 | 522 | ||
523 | static const char *zfcp_rec_dbf_tags[] = { | 523 | static const char *zfcp_rec_dbf_tags[] = { |
524 | [ZFCP_REC_DBF_ID_THREAD] = "thread", | ||
524 | }; | 525 | }; |
525 | 526 | ||
526 | static const char *zfcp_rec_dbf_ids[] = { | 527 | static const char *zfcp_rec_dbf_ids[] = { |
528 | [1] = "new", | ||
529 | [2] = "ready", | ||
530 | [3] = "kill", | ||
531 | [4] = "down sleep", | ||
532 | [5] = "down wakeup", | ||
533 | [6] = "down sleep ecd", | ||
534 | [7] = "down wakeup ecd", | ||
535 | [8] = "down sleep epd", | ||
536 | [9] = "down wakeup epd", | ||
527 | }; | 537 | }; |
528 | 538 | ||
529 | static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, | 539 | static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, |
@@ -536,6 +546,12 @@ static int zfcp_rec_dbf_view_format(debug_info_t *id, struct debug_view *view, | |||
536 | zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]); | 546 | zfcp_dbf_outs(&p, "hint", zfcp_rec_dbf_ids[r->id2]); |
537 | zfcp_dbf_out(&p, "id", "%d", r->id2); | 547 | zfcp_dbf_out(&p, "id", "%d", r->id2); |
538 | switch (r->id) { | 548 | switch (r->id) { |
549 | case ZFCP_REC_DBF_ID_THREAD: | ||
550 | zfcp_dbf_out(&p, "sema", "%d", r->u.thread.sema); | ||
551 | zfcp_dbf_out(&p, "total", "%d", r->u.thread.total); | ||
552 | zfcp_dbf_out(&p, "ready", "%d", r->u.thread.ready); | ||
553 | zfcp_dbf_out(&p, "running", "%d", r->u.thread.running); | ||
554 | break; | ||
539 | } | 555 | } |
540 | sprintf(p, "\n"); | 556 | sprintf(p, "\n"); |
541 | return (p - buf) + 1; | 557 | return (p - buf) + 1; |
@@ -550,6 +566,41 @@ static struct debug_view zfcp_rec_dbf_view = { | |||
550 | NULL | 566 | NULL |
551 | }; | 567 | }; |
552 | 568 | ||
569 | /** | ||
570 | * zfcp_rec_dbf_event_thread - trace event related to recovery thread operation | ||
571 | * @id2: identifier for event | ||
572 | * @adapter: adapter | ||
573 | * @lock: non-zero value indicates that erp_lock has not yet been acquired | ||
574 | */ | ||
575 | void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter, int lock) | ||
576 | { | ||
577 | struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | ||
578 | unsigned long flags = 0; | ||
579 | struct list_head *entry; | ||
580 | unsigned ready = 0, running = 0, total; | ||
581 | |||
582 | if (lock) | ||
583 | read_lock_irqsave(&adapter->erp_lock, flags); | ||
584 | list_for_each(entry, &adapter->erp_ready_head) | ||
585 | ready++; | ||
586 | list_for_each(entry, &adapter->erp_running_head) | ||
587 | running++; | ||
588 | total = adapter->erp_total_count; | ||
589 | if (lock) | ||
590 | read_unlock_irqrestore(&adapter->erp_lock, flags); | ||
591 | |||
592 | spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | ||
593 | memset(r, 0, sizeof(*r)); | ||
594 | r->id = ZFCP_REC_DBF_ID_THREAD; | ||
595 | r->id2 = id2; | ||
596 | r->u.thread.sema = atomic_read(&adapter->erp_ready_sem.count); | ||
597 | r->u.thread.total = total; | ||
598 | r->u.thread.ready = ready; | ||
599 | r->u.thread.running = running; | ||
600 | debug_event(adapter->rec_dbf, 5, r, sizeof(*r)); | ||
601 | spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | ||
602 | } | ||
603 | |||
553 | static void | 604 | static void |
554 | _zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, | 605 | _zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req, |
555 | u32 s_id, u32 d_id, void *buffer, int buflen) | 606 | u32 s_id, u32 d_id, void *buffer, int buflen) |