diff options
author | Moger, Babu <Babu.Moger@lsi.com> | 2009-09-03 23:42:28 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-12 10:35:31 -0400 |
commit | dd784edcfc080fb4c83f1f3d10d905c5ab61616f (patch) | |
tree | 70223a5eba6d91801c749aa7e6b3718c1b0c0a2c | |
parent | 1527666e6af977cc287e0f7088356c8be29b3f75 (diff) |
[SCSI] scsi_dh_rdac: changes for rdac debug logging
Patch to add debugging stuff for rdac device handler.
- Added a bit mask "module parameter" rdac_logging with 2 bits for each type
of logging.
- currently defined only two types of logging(failover and sense logging). Can
be enhanced later if required.
- By default only failover logging is enabled which is equivalent of current
logging.
Signed-off-by: Babu Moger <babu.moger@lsi.com>
Reviewed-by: Vijay Chauhan <vijay.chauhan@lsi.com>
Reviewed-by: Bob Stankey <Robert.stankey@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_rdac.c | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c b/drivers/scsi/device_handler/scsi_dh_rdac.c index 9f1c4c2df924..11c89311427e 100644 --- a/drivers/scsi/device_handler/scsi_dh_rdac.c +++ b/drivers/scsi/device_handler/scsi_dh_rdac.c | |||
@@ -201,6 +201,31 @@ static const char *lun_state[] = | |||
201 | static LIST_HEAD(ctlr_list); | 201 | static LIST_HEAD(ctlr_list); |
202 | static DEFINE_SPINLOCK(list_lock); | 202 | static DEFINE_SPINLOCK(list_lock); |
203 | 203 | ||
204 | /* | ||
205 | * module parameter to enable rdac debug logging. | ||
206 | * 2 bits for each type of logging, only two types defined for now | ||
207 | * Can be enhanced if required at later point | ||
208 | */ | ||
209 | static int rdac_logging = 1; | ||
210 | module_param(rdac_logging, int, S_IRUGO|S_IWUSR); | ||
211 | MODULE_PARM_DESC(rdac_logging, "A bit mask of rdac logging levels, " | ||
212 | "Default is 1 - failover logging enabled, " | ||
213 | "set it to 0xF to enable all the logs"); | ||
214 | |||
215 | #define RDAC_LOG_FAILOVER 0 | ||
216 | #define RDAC_LOG_SENSE 2 | ||
217 | |||
218 | #define RDAC_LOG_BITS 2 | ||
219 | |||
220 | #define RDAC_LOG_LEVEL(SHIFT) \ | ||
221 | ((rdac_logging >> (SHIFT)) & ((1 << (RDAC_LOG_BITS)) - 1)) | ||
222 | |||
223 | #define RDAC_LOG(SHIFT, sdev, f, arg...) \ | ||
224 | do { \ | ||
225 | if (unlikely(RDAC_LOG_LEVEL(SHIFT))) \ | ||
226 | sdev_printk(KERN_INFO, sdev, RDAC_NAME ": " f "\n", ## arg); \ | ||
227 | } while (0); | ||
228 | |||
204 | static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev) | 229 | static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev) |
205 | { | 230 | { |
206 | struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data; | 231 | struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data; |
@@ -469,6 +494,7 @@ static int mode_select_handle_sense(struct scsi_device *sdev, | |||
469 | { | 494 | { |
470 | struct scsi_sense_hdr sense_hdr; | 495 | struct scsi_sense_hdr sense_hdr; |
471 | int err = SCSI_DH_IO, ret; | 496 | int err = SCSI_DH_IO, ret; |
497 | struct rdac_dh_data *h = get_rdac_data(sdev); | ||
472 | 498 | ||
473 | ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr); | 499 | ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr); |
474 | if (!ret) | 500 | if (!ret) |
@@ -497,11 +523,14 @@ static int mode_select_handle_sense(struct scsi_device *sdev, | |||
497 | err = SCSI_DH_RETRY; | 523 | err = SCSI_DH_RETRY; |
498 | break; | 524 | break; |
499 | default: | 525 | default: |
500 | sdev_printk(KERN_INFO, sdev, | 526 | break; |
501 | "MODE_SELECT failed with sense %02x/%02x/%02x.\n", | ||
502 | sense_hdr.sense_key, sense_hdr.asc, sense_hdr.ascq); | ||
503 | } | 527 | } |
504 | 528 | ||
529 | RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " | ||
530 | "MODE_SELECT returned with sense %02x/%02x/%02x", | ||
531 | (char *) h->ctlr->array_name, h->ctlr->index, | ||
532 | sense_hdr.sense_key, sense_hdr.asc, sense_hdr.ascq); | ||
533 | |||
505 | done: | 534 | done: |
506 | return err; | 535 | return err; |
507 | } | 536 | } |
@@ -518,7 +547,9 @@ retry: | |||
518 | if (!rq) | 547 | if (!rq) |
519 | goto done; | 548 | goto done; |
520 | 549 | ||
521 | sdev_printk(KERN_INFO, sdev, "%s MODE_SELECT command.\n", | 550 | RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " |
551 | "%s MODE_SELECT command", | ||
552 | (char *) h->ctlr->array_name, h->ctlr->index, | ||
522 | (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); | 553 | (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); |
523 | 554 | ||
524 | err = blk_execute_rq(q, NULL, rq, 1); | 555 | err = blk_execute_rq(q, NULL, rq, 1); |
@@ -528,8 +559,12 @@ retry: | |||
528 | if (err == SCSI_DH_RETRY && retry_cnt--) | 559 | if (err == SCSI_DH_RETRY && retry_cnt--) |
529 | goto retry; | 560 | goto retry; |
530 | } | 561 | } |
531 | if (err == SCSI_DH_OK) | 562 | if (err == SCSI_DH_OK) { |
532 | h->state = RDAC_STATE_ACTIVE; | 563 | h->state = RDAC_STATE_ACTIVE; |
564 | RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " | ||
565 | "MODE_SELECT completed", | ||
566 | (char *) h->ctlr->array_name, h->ctlr->index); | ||
567 | } | ||
533 | 568 | ||
534 | done: | 569 | done: |
535 | return err; | 570 | return err; |
@@ -567,6 +602,12 @@ static int rdac_check_sense(struct scsi_device *sdev, | |||
567 | struct scsi_sense_hdr *sense_hdr) | 602 | struct scsi_sense_hdr *sense_hdr) |
568 | { | 603 | { |
569 | struct rdac_dh_data *h = get_rdac_data(sdev); | 604 | struct rdac_dh_data *h = get_rdac_data(sdev); |
605 | |||
606 | RDAC_LOG(RDAC_LOG_SENSE, sdev, "array %s, ctlr %d, " | ||
607 | "I/O returned with sense %02x/%02x/%02x", | ||
608 | (char *) h->ctlr->array_name, h->ctlr->index, | ||
609 | sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); | ||
610 | |||
570 | switch (sense_hdr->sense_key) { | 611 | switch (sense_hdr->sense_key) { |
571 | case NOT_READY: | 612 | case NOT_READY: |
572 | if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) | 613 | if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01) |