From patchwork Wed Sep 2 23:12:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: babu moger X-Patchwork-Id: 45279 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 n82NQZkp030375 for ; Wed, 2 Sep 2009 23:26:36 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 76B19619133; Wed, 2 Sep 2009 19:13:09 -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 n82ND7uR018467 for ; Wed, 2 Sep 2009 19:13:07 -0400 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.13]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n82ND7YE030635 for ; Wed, 2 Sep 2009 19:13:07 -0400 Received: from exprod7og119.obsmtp.com (exprod7og119.obsmtp.com [64.18.2.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n82NCw2Q026533 for ; Wed, 2 Sep 2009 19:12:58 -0400 Received: from source ([147.145.40.20]) by exprod7ob119.postini.com ([64.18.6.12]) with SMTP ID DSNKSp77+NoQo62q0+2VT3XyPxcMFGDpai/Y@postini.com; Wed, 02 Sep 2009 16:12:58 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 n82NCu5V008707; Wed, 2 Sep 2009 16:12:56 -0700 (PDT) Received: from coscas01.lsi.com (coscas01.co.lsil.com [172.21.36.60]) by milmhbs0.lsil.com (8.12.11/8.12.11) with ESMTP id n82NCvgL021420; Wed, 2 Sep 2009 16:12:57 -0700 Received: from cosmail01.lsi.com ([172.21.36.24]) by coscas01.lsi.com ([172.21.36.60]) with mapi; Wed, 2 Sep 2009 17:12:55 -0600 From: "Moger, Babu" To: "'linux-scsi@vger.kernel.org'" Date: Wed, 2 Sep 2009 17:12:55 -0600 Thread-Topic: [PATCH 1/3][RESUBMIT] scsi_dh_rdac: changes to collect the rdac debug information during the initialization Thread-Index: AcosIucJ5J2r6bojR7ai1RJjYGsj8w== 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.13 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 n82ND7uR018467 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 1/3][RESUBMIT] scsi_dh_rdac: changes to collect the rdac debug information during the initialization 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 Adding the code to read the debug information during initialization. This patch collects the information about storage and controllers during rdac_activate. 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-09-02 09:49:23.000000000 -0500 +++ linux-2.6.31-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c 2009-09-02 10:04:40.000000000 -0500 @@ -112,6 +112,7 @@ struct c9_inquiry { #define SUBSYS_ID_LEN 16 #define SLOT_ID_LEN 2 +#define ARRAY_LABEL_LEN 31 struct c4_inquiry { u8 peripheral_info; @@ -135,6 +136,8 @@ struct rdac_controller { struct rdac_pg_legacy legacy; struct rdac_pg_expanded expanded; } mode_select; + u8 index; + u8 array_name[ARRAY_LABEL_LEN]; }; struct c8_inquiry { u8 peripheral_info; @@ -303,7 +306,8 @@ static void release_controller(struct kr kfree(ctlr); } -static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id) +static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id, + char *array_name) { struct rdac_controller *ctlr, *tmp; @@ -324,6 +328,14 @@ static struct rdac_controller *get_contr /* initialize fields of controller */ memcpy(ctlr->subsys_id, subsys_id, SUBSYS_ID_LEN); memcpy(ctlr->slot_id, slot_id, SLOT_ID_LEN); + memcpy(ctlr->array_name, array_name, ARRAY_LABEL_LEN); + + /* update the controller index */ + if (slot_id[1] == 0x31) + ctlr->index = 0; + else + ctlr->index = 1; + kref_init(&ctlr->kref); ctlr->use_ms10 = -1; list_add(&ctlr->node, &ctlr_list); @@ -363,9 +375,10 @@ done: return err; } -static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h) +static int get_lun_info(struct scsi_device *sdev, struct rdac_dh_data *h, + char *array_name) { - int err; + int err, i; struct c8_inquiry *inqp; err = submit_inquiry(sdev, 0xC8, sizeof(struct c8_inquiry), h); @@ -377,6 +390,11 @@ static int get_lun(struct scsi_device *s inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd') return SCSI_DH_NOSYS; h->lun = inqp->lun[7]; /* Uses only the last byte */ + + for(i=0; iarray_user_label[(2*i)+1]; + + *(array_name+ARRAY_LABEL_LEN-1) = '\0'; } return err; } @@ -410,7 +428,7 @@ static int check_ownership(struct scsi_d } static int initialize_controller(struct scsi_device *sdev, - struct rdac_dh_data *h) + struct rdac_dh_data *h, char *array_name) { int err; struct c4_inquiry *inqp; @@ -418,7 +436,8 @@ static int initialize_controller(struct err = submit_inquiry(sdev, 0xC4, sizeof(struct c4_inquiry), h); if (err == SCSI_DH_OK) { inqp = &h->inq.c4; - h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id); + h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id, + array_name); if (!h->ctlr) err = SCSI_DH_RES_TEMP_UNAVAIL; } @@ -520,13 +539,14 @@ static int rdac_activate(struct scsi_dev { struct rdac_dh_data *h = get_rdac_data(sdev); int err = SCSI_DH_OK; + char array_name[ARRAY_LABEL_LEN]; err = check_ownership(sdev, h); if (err != SCSI_DH_OK) goto done; if (!h->ctlr) { - err = initialize_controller(sdev, h); + err = initialize_controller(sdev, h, array_name); if (err != SCSI_DH_OK) goto done; } @@ -656,6 +676,7 @@ static int rdac_bus_attach(struct scsi_d struct rdac_dh_data *h; unsigned long flags; int err; + char array_name[ARRAY_LABEL_LEN]; scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *) + sizeof(*h) , GFP_KERNEL); @@ -670,7 +691,7 @@ static int rdac_bus_attach(struct scsi_d h->lun = UNINITIALIZED_LUN; h->state = RDAC_STATE_ACTIVE; - err = get_lun(sdev, h); + err = get_lun_info(sdev, h, array_name); if (err != SCSI_DH_OK) goto failed;