From: Chandra Seetharaman <sekharan@us.ibm.com>
To: linux-scsi@vger.kernel.org
Cc: dm-devel@redhat.com, michaelc@cs.wisc.edu, agk@redhat.com,
James.Bottomley@HansenPartnership.com, Benoit_Arthur@emc.com,
asson_ronald@emc.com, berthiaume_wayne@emc.com,
Eddie.Williams@steeleye.com,
Chandra Seetharaman <sekharan@us.ibm.com>
Subject: [PATCH 3/3] scsi_dh: Use scsi_dh_set_params() in multipath.
Date: Wed, 01 Jul 2009 20:13:26 -0700 [thread overview]
Message-ID: <20090702031326.28354.82033.sendpatchset@chandra-ubuntu> (raw)
In-Reply-To: <20090702031308.28354.73353.sendpatchset@chandra-ubuntu>
Use scsi_dh_set_params() set parameters provided. Save the parameters in
parse_hw_handler() and use it in parse_path().
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
---
drivers/md/dm-mpath.c | 42 ++++++++++++++++++++++++++++++++++++------
1 file changed, 36 insertions(+), 6 deletions(-)
Index: linux-2.6.31-rc1/drivers/md/dm-mpath.c
===================================================================
--- linux-2.6.31-rc1.orig/drivers/md/dm-mpath.c
+++ linux-2.6.31-rc1/drivers/md/dm-mpath.c
@@ -64,6 +64,7 @@ struct multipath {
spinlock_t lock;
const char *hw_handler_name;
+ char *hw_handler_params;
unsigned nr_priority_groups;
struct list_head priority_groups;
unsigned pg_init_required; /* pg_init needs calling? */
@@ -219,6 +220,7 @@ static void free_multipath(struct multip
}
kfree(m->hw_handler_name);
+ kfree(m->hw_handler_params);
mempool_destroy(m->mpio_pool);
kfree(m);
}
@@ -615,6 +617,17 @@ static struct pgpath *parse_path(struct
dm_put_device(ti, p->path.dev);
goto bad;
}
+
+ if (m->hw_handler_params) {
+ r = scsi_dh_set_params(q, m->hw_handler_params);
+ if (r < 0) {
+ ti->error = "unable to set hardware "
+ "handler parameters";
+ scsi_dh_detach(q);
+ dm_put_device(ti, p->path.dev);
+ goto bad;
+ }
+ }
}
r = ps->type->add_path(ps, &p->path, as->argc, as->argv, &ti->error);
@@ -705,6 +718,7 @@ static struct priority_group *parse_prio
static int parse_hw_handler(struct arg_set *as, struct multipath *m)
{
unsigned hw_argc;
+ int ret;
struct dm_target *ti = m->ti;
static struct param _params[] = {
@@ -726,17 +740,33 @@ static int parse_hw_handler(struct arg_s
request_module("scsi_dh_%s", m->hw_handler_name);
if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
ti->error = "unknown hardware handler type";
- kfree(m->hw_handler_name);
- m->hw_handler_name = NULL;
- return -EINVAL;
+ ret = -EINVAL;
+ goto fail;
}
- if (hw_argc > 1)
- DMWARN("Ignoring user-specified arguments for "
- "hardware handler \"%s\"", m->hw_handler_name);
+ if (hw_argc > 1) {
+ char *p;
+ int i, j, len = 4;
+
+ for (i = 0; i <= hw_argc - 2; i++)
+ len += strlen(as->argv[i]) + 1;
+ p = m->hw_handler_params = kzalloc(len, GFP_KERNEL);
+ if (!p) {
+ ti->error = "memory allocation failed";
+ ret = -ENOMEM;
+ goto fail;
+ }
+ j = sprintf(p, "%d", hw_argc - 1);
+ for (i = 0, p+=j+1; i <= hw_argc - 2; i++, p+=j+1)
+ j = sprintf(p, "%s", as->argv[i]);
+ }
consume(as, hw_argc - 1);
return 0;
+fail:
+ kfree(m->hw_handler_name);
+ m->hw_handler_name = NULL;
+ return ret;
}
static int parse_features(struct arg_set *as, struct multipath *m)
next prev parent reply other threads:[~2009-07-02 3:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-02 3:13 [PATCH 0/3] scsi_dh: Add ability to set parameters for scsi device handler Chandra Seetharaman
2009-07-02 3:13 ` [PATCH 1/3] scsi_dh: add the interface scsi_dh_set_params() Chandra Seetharaman
2009-07-02 3:13 ` [PATCH 2/3] scsi_dh: Provide set_params interface in emc device handler Chandra Seetharaman
2009-07-20 13:00 ` Eddie Williams
2009-07-21 1:02 ` Chandra Seetharaman
2009-07-02 3:13 ` Chandra Seetharaman [this message]
2009-07-02 14:07 ` [PATCH 0/3] scsi_dh: Add ability to set parameters for scsi " Eddie Williams
2009-07-02 19:34 ` Eddie Williams
2009-07-02 20:29 ` Eddie Williams
2009-07-02 20:47 ` Chandra Seetharaman
2009-07-07 12:34 ` Eddie Williams
[not found] ` <1247169346.28322.0.camel@chandra-ubuntu>
[not found] ` <1247174184.6367.237.camel@eddie-laptop>
2009-07-10 1:59 ` [dm-devel] " Chandra Seetharaman
2009-07-10 13:21 ` Eddie Williams
2009-07-20 13:05 ` Eddie Williams
2009-07-21 1:01 ` Chandra Seetharaman
2009-07-21 19:36 ` Eddie Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090702031326.28354.82033.sendpatchset@chandra-ubuntu \
--to=sekharan@us.ibm.com \
--cc=Benoit_Arthur@emc.com \
--cc=Eddie.Williams@steeleye.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=agk@redhat.com \
--cc=asson_ronald@emc.com \
--cc=berthiaume_wayne@emc.com \
--cc=dm-devel@redhat.com \
--cc=linux-scsi@vger.kernel.org \
--cc=michaelc@cs.wisc.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox