From patchwork Wed Sep 2 23:13:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: babu moger X-Patchwork-Id: 45276 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 n82NDX4j029024 for ; Wed, 2 Sep 2009 23:13:34 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 761DD6196B4; Wed, 2 Sep 2009 19:13:33 -0400 (EDT) Received: from int-mx04.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 n82NDVGZ018480 for ; Wed, 2 Sep 2009 19:13:31 -0400 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.13]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n82NDV1B024166 for ; Wed, 2 Sep 2009 19:13:31 -0400 Received: from exprod7og111.obsmtp.com (exprod7og111.obsmtp.com [64.18.2.175]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n82NDGeX026549 for ; Wed, 2 Sep 2009 19:13:16 -0400 Received: from source ([147.145.40.20]) by exprod7ob111.postini.com ([64.18.6.12]) with SMTP ID DSNKSp78C9alS5KVnPAXVWjNKhcwFUqc3QGD@postini.com; Wed, 02 Sep 2009 16:13:19 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 n82NDE8S008750; Wed, 2 Sep 2009 16:13:14 -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 n82NDF4g021456; Wed, 2 Sep 2009 16:13:15 -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:13:13 -0600 From: "Moger, Babu" To: "'linux-scsi@vger.kernel.org'" Date: Wed, 2 Sep 2009 17:13:13 -0600 Thread-Topic: [PATCH 2/3][RESUBMIT] scsi_dh_rdac: move the init code from rdac_activate to rdac_bus_attach Thread-Index: AcosIvIhaqF2WIJpQWiAEaQvrW3A4Q== 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.17 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 n82NDVGZ018480 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 2/3][RESUBMIT] scsi_dh_rdac: move the init code from rdac_activate to rdac_bus_attach 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 Moving the initialization code from rdac_activate to rdac_bus_attach which is more efficient. We don't have to collect all these information during every 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 10:06:46.000000000 -0500 +++ linux-2.6.31-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c 2009-09-02 10:08:06.000000000 -0500 @@ -539,23 +539,11 @@ 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, array_name); - if (err != SCSI_DH_OK) - goto done; - } - - if (h->ctlr->use_ms10 == -1) { - err = set_mode_select(sdev, h); - if (err != SCSI_DH_OK) - goto done; - } if (h->lun_state == RDAC_LUN_UNOWNED) err = send_mode_select(sdev, h); done: @@ -695,12 +683,20 @@ static int rdac_bus_attach(struct scsi_d if (err != SCSI_DH_OK) goto failed; - err = check_ownership(sdev, h); + err = initialize_controller(sdev, h, array_name); if (err != SCSI_DH_OK) goto failed; + err = check_ownership(sdev, h); + if (err != SCSI_DH_OK) + goto clean_ctlr; + + err = set_mode_select(sdev, h); + if (err != SCSI_DH_OK) + goto clean_ctlr; + if (!try_module_get(THIS_MODULE)) - goto failed; + goto clean_ctlr; spin_lock_irqsave(sdev->request_queue->queue_lock, flags); sdev->scsi_dh_data = scsi_dh_data; @@ -712,6 +708,9 @@ static int rdac_bus_attach(struct scsi_d return 0; +clean_ctlr: + kref_put(&h->ctlr->kref, release_controller); + failed: kfree(scsi_dh_data); sdev_printk(KERN_ERR, sdev, "%s: not attached\n",