From patchwork Fri Sep 4 03:42:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: babu moger X-Patchwork-Id: 45506 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 n843gb2i013131 for ; Fri, 4 Sep 2009 03:42:37 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 A844061A039; Thu, 3 Sep 2009 23:42:36 -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 n843gYkg004886 for ; Thu, 3 Sep 2009 23:42:34 -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 n843gYVt006766 for ; Thu, 3 Sep 2009 23:42:34 -0400 Received: from exprod7og110.obsmtp.com (exprod7og110.obsmtp.com [64.18.2.173]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n843gIaN017250 for ; Thu, 3 Sep 2009 23:42:19 -0400 Received: from source ([147.145.40.20]) by exprod7ob110.postini.com ([64.18.6.12]) with SMTP ID DSNKSqCMmS/OeOMlLjkqi3yAHC4sjm1cyWn/@postini.com; Thu, 03 Sep 2009 20:42:22 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 n843gGIu002319; Thu, 3 Sep 2009 20:42:16 -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 n843gJNG022968; Thu, 3 Sep 2009 20:42:19 -0700 Received: from cosmail01.lsi.com ([172.21.36.24]) by coshub01.lsi.com ([172.21.36.64]) with mapi; Thu, 3 Sep 2009 21:42:16 -0600 From: "Moger, Babu" To: "'linux-scsi@vger.kernel.org'" Date: Thu, 3 Sep 2009 21:42:15 -0600 Thread-Topic: [PATCH 1/3][RESUBMIT] scsi_dh_rdac: move the init code from rdac_activate to rdac_bus_attach Thread-Index: AcotEbGmO7UEG1nHQ8WsY6TyFaHzfQ== 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 n843gYkg004886 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: 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 the information during every activate. Signed-off-by: Babu Moger Reviewed-by: Vijay Chauhan Reviewed-by: Bob Stankey Acked-by: Chandra Seetharaman --- -- 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-03 13:39:52.000000000 -0500 +++ linux-2.6.31-rc5/drivers/scsi/device_handler/scsi_dh_rdac.c 2009-09-03 14:10:40.000000000 -0500 @@ -525,17 +525,6 @@ static int rdac_activate(struct scsi_dev if (err != SCSI_DH_OK) goto done; - if (!h->ctlr) { - err = initialize_controller(sdev, h); - 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: @@ -674,12 +663,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); 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; @@ -691,6 +688,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",