From patchwork Fri Aug 28 14:23:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: babu moger X-Patchwork-Id: 44512 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7SENTEi017491 for ; Fri, 28 Aug 2009 14:23:29 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 418C161AA7E; Fri, 28 Aug 2009 10:23:29 -0400 (EDT) Received: from int-mx05.intmail.prod.int.phx2.redhat.com (nat-pool.util.phx.redhat.com [10.8.5.200]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n7SENQhF028218 for ; Fri, 28 Aug 2009 10:23:26 -0400 Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.10]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7SENQU9028718 for ; Fri, 28 Aug 2009 10:23:26 -0400 Received: from exprod7og113.obsmtp.com (exprod7og113.obsmtp.com [64.18.2.179]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7SENCvs012078 for ; Fri, 28 Aug 2009 10:23:13 -0400 Received: from source ([147.145.40.20]) by exprod7ob113.postini.com ([64.18.6.12]) with SMTP ID DSNKSpfoTu6QxRFJgCRBJ1vz5RFrLS1dQjZu@postini.com; Fri, 28 Aug 2009 07:23:14 PDT Received: from milmhbs0.lsil.com (mhbs.lsil.com [147.145.1.30]) by mail0.lsil.com (8.12.11/8.12.11) with ESMTP id n7SEN9Li026008; Fri, 28 Aug 2009 07:23:09 -0700 (PDT) Received: from coshub01.lsi.com (coshub01.co.lsil.com [172.21.36.64]) by milmhbs0.lsil.com (8.12.11/8.12.11) with ESMTP id n7SENBmn015106; Fri, 28 Aug 2009 07:23:11 -0700 Received: from cosmail01.lsi.com ([172.21.36.24]) by coshub01.lsi.com ([172.21.36.64]) with mapi; Fri, 28 Aug 2009 08:23:08 -0600 From: "Moger, Babu" To: "'linux-scsi@vger.kernel.org'" Date: Fri, 28 Aug 2009 08:23:06 -0600 Thread-Topic: [PATCH 3/3][RESUBMIT] scsi_dh_rdac: changes for rdac debug logging Thread-Index: Acon6w/Nrhlf+FZ+QnqBVEYn2zc95w== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.10 X-Scanned-By: MIMEDefang 2.39 X-RedHat-Spam-Score: -4 (RCVD_IN_DNSWL_MED) X-MIME-Autoconverted: from quoted-printable to 8bit by listman.util.phx.redhat.com id n7SENQhF028218 X-loop: dm-devel@redhat.com Cc: "Dachepalli, Sudhir" , "'device mapper development'" , "Chauhan, Vijay" , "Stankey, Robert" , "'sekharan@linux.vnet.ibm.com'" Subject: [dm-devel] [PATCH 3/3][RESUBMIT] scsi_dh_rdac: changes for rdac debug logging X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com 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 Reviewed-by: Vijay Chauhan Reviewed-by: Bob Stankey --- -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel --- linux-2.6.31-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c.orig 2009-08-27 18:33:39.000000000 -0500 +++ linux-2.6.31-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c 2009-08-27 18:35:24.000000000 -0500 @@ -201,6 +201,31 @@ static const char *lun_state[] = static LIST_HEAD(ctlr_list); static DEFINE_SPINLOCK(list_lock); +/* + * module parameter to enable rdac debug logging. + * 2 bits for each type of logging, only two types defined for now + * Can be enhanced if required at later point + */ +static int rdac_logging = 1; +module_param(rdac_logging, int, S_IRUGO|S_IWUSR); +MODULE_PARM_DESC(rdac_logging, "A bit mask of rdac logging levels, " + "Default is 1 - failover logging enabled, " + "set it to 0xF to enable all the logs"); + +#define RDAC_LOG_FAILOVER 0 +#define RDAC_LOG_SENSE 2 + +#define RDAC_LOG_BITS 2 + +#define RDAC_LOG_LEVEL(SHIFT) \ + ((rdac_logging >> (SHIFT)) & ((1 << (RDAC_LOG_BITS)) - 1)) + +#define RDAC_LOG(SHIFT, sdev, f, arg...) \ +do { \ + if (unlikely(RDAC_LOG_LEVEL(SHIFT))) \ + sdev_printk(KERN_INFO, sdev, RDAC_NAME ": " f "\n", ## arg); \ +} while (0); + static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev) { struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data; @@ -480,6 +505,7 @@ static int mode_select_handle_sense(stru { struct scsi_sense_hdr sense_hdr; int err = SCSI_DH_IO, ret; + struct rdac_dh_data *h = get_rdac_data(sdev); ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr); if (!ret) @@ -508,11 +534,14 @@ static int mode_select_handle_sense(stru err = SCSI_DH_RETRY; break; default: - sdev_printk(KERN_INFO, sdev, - "MODE_SELECT failed with sense %02x/%02x/%02x.\n", - sense_hdr.sense_key, sense_hdr.asc, sense_hdr.ascq); + break; } + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " + "MODE_SELECT returned with sense %02x/%02x/%02x", + (char *) h->ctlr->array_name, h->ctlr->index, + sense_hdr.sense_key, sense_hdr.asc, sense_hdr.ascq); + done: return err; } @@ -529,7 +558,9 @@ retry: if (!rq) goto done; - sdev_printk(KERN_INFO, sdev, "%s MODE_SELECT command.\n", + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " + "%s MODE_SELECT command", + (char *) h->ctlr->array_name, h->ctlr->index, (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying"); err = blk_execute_rq(q, NULL, rq, 1); @@ -539,8 +570,12 @@ retry: if (err == SCSI_DH_RETRY && retry_cnt--) goto retry; } - if (err == SCSI_DH_OK) + if (err == SCSI_DH_OK) { h->state = RDAC_STATE_ACTIVE; + RDAC_LOG(RDAC_LOG_FAILOVER, sdev, "array %s, ctlr %d, " + "MODE_SELECT completed", + (char *) h->ctlr->array_name, h->ctlr->index); + } done: return err; @@ -578,6 +613,12 @@ static int rdac_check_sense(struct scsi_ struct scsi_sense_hdr *sense_hdr) { struct rdac_dh_data *h = get_rdac_data(sdev); + + RDAC_LOG(RDAC_LOG_SENSE, sdev, "array %s, ctlr %d, " + "I/O returned with sense %02x/%02x/%02x", + (char *) h->ctlr->array_name, h->ctlr->index, + sense_hdr->sense_key, sense_hdr->asc, sense_hdr->ascq); + switch (sense_hdr->sense_key) { case NOT_READY: if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x01)