From patchwork Mon Aug 3 19:42:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Seetharaman X-Patchwork-Id: 38983 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 n73JdDmf022520 for ; Mon, 3 Aug 2009 19:39:13 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 5910A61B2C2; Mon, 3 Aug 2009 15:39:13 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n73JdBOU014258 for ; Mon, 3 Aug 2009 15:39:11 -0400 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n73JdAQs032718 for ; Mon, 3 Aug 2009 15:39:10 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n73JcsW4010658 for ; Mon, 3 Aug 2009 15:38:54 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e31.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id n73JXbpD024166 for ; Mon, 3 Aug 2009 13:33:37 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n73Jcqs1233698 for ; Mon, 3 Aug 2009 13:38:52 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n73JcqcL005759 for ; Mon, 3 Aug 2009 13:38:52 -0600 Received: from [127.0.1.1] (chandra-ubuntu.beaverton.ibm.com [9.47.17.98]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id n73Jcptv005695; Mon, 3 Aug 2009 13:38:51 -0600 From: Chandra Seetharaman To: linux-scsi@vger.kernel.org Date: Mon, 03 Aug 2009 12:42:39 -0700 Message-Id: <20090803194239.5738.74280.sendpatchset@chandra-ubuntu> In-Reply-To: <20090803194226.5738.82973.sendpatchset@chandra-ubuntu> References: <20090803194226.5738.82973.sendpatchset@chandra-ubuntu> X-RedHat-Spam-Score: -3.773 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-loop: dm-devel@redhat.com Cc: michaelc@cs.wisc.edu, asson_ronald@emc.com, James.Bottomley@HansenPartnership.com, dm-devel@redhat.com, Benoit_Arthur@emc.com, Eddie.Williams@steeleye.com, agk@redhat.com Subject: [dm-devel] [RESEND] [PATCH 2/3] scsi_dh: Provide set_params interface in emc device handler 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 Handle the parameters provided by user thru multipath. This handler expects only 2 parameters and their value can either be 0 or 1. This code originates from the old dm-emc.c file. Appropriate changes have been made to make it work in the new design. Reported-by: Eddie Williams Signed-off-by: Chandra Seetharaman Tested-by: Eddie Williams --- drivers/scsi/device_handler/scsi_dh_emc.c | 59 ++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6.31-rc3/drivers/scsi/device_handler/scsi_dh_emc.c =================================================================== --- linux-2.6.31-rc3.orig/drivers/scsi/device_handler/scsi_dh_emc.c +++ linux-2.6.31-rc3/drivers/scsi/device_handler/scsi_dh_emc.c @@ -561,6 +561,61 @@ done: return result; } +/* + * params - parameters in the following format + * "no_of_params\0param1\0param2\0param3\0...\0" + * for example, string for 2 parameters with value 10 and 21 + * is specified as "2\010\021\0". + */ +static int clariion_set_params(struct scsi_device *sdev, const char *params) +{ + struct clariion_dh_data *csdev = get_clariion_data(sdev); + unsigned int hr = 0, st = 0, argc; + const char *p = params; + int result = SCSI_DH_OK; + + if ((sscanf(params, "%u", &argc) != 1) || (argc != 2)) + return -EINVAL; + + while (*p++) + ; + if ((sscanf(p, "%u", &st) != 1) || (st > 1)) + return -EINVAL; + + while (*p++) + ; + if ((sscanf(p, "%u", &hr) != 1) || (hr > 1)) + return -EINVAL; + + if (st) + csdev->flags |= CLARIION_SHORT_TRESPASS; + else + csdev->flags &= ~CLARIION_SHORT_TRESPASS; + + if (hr) + csdev->flags |= CLARIION_HONOR_RESERVATIONS; + else + csdev->flags &= ~CLARIION_HONOR_RESERVATIONS; + + /* + * If this path is owned, we have to send a trespass command + * with the new parameters. If not, simply return. Next trespass + * command would use the parameters. + */ + if (csdev->lun_state != CLARIION_LUN_OWNED) + goto done; + + csdev->lun_state = CLARIION_LUN_UNINITIALIZED; + result = send_trespass_cmd(sdev, csdev); + if (result != SCSI_DH_OK) + goto done; + + /* Update status */ + result = clariion_send_inquiry(sdev, csdev); + +done: + return result; +} static const struct scsi_dh_devlist clariion_dev_list[] = { {"DGC", "RAID"}, @@ -581,11 +636,9 @@ static struct scsi_device_handler clarii .check_sense = clariion_check_sense, .activate = clariion_activate, .prep_fn = clariion_prep_fn, + .set_params = clariion_set_params, }; -/* - * TODO: need some interface so we can set trespass values - */ static int clariion_bus_attach(struct scsi_device *sdev) { struct scsi_dh_data *scsi_dh_data;