From: Mike Snitzer <snitzer@redhat.com>
To: dm-devel@redhat.com
Cc: babu.moger@netapp.com, agk@redhat.com
Subject: [PATCH v3 4/5] dm mpath: add 'default_hw_handler' feature
Date: Thu, 10 May 2012 17:31:47 -0400 [thread overview]
Message-ID: <20120510213147.GA5946@redhat.com> (raw)
In-Reply-To: <1336514167-15393-5-git-send-email-snitzer@redhat.com>
When specifying the feature 'default_hw_handler' multipath will use
the currently attached hardware handler instead of trying to attach the
one specified during table load. If no hardware handler is attached the
specified hardware handler will be used.
Leverages scsi_dh_attach's ability to increment the scsi_dh's reference
count if the same scsi_dh name is provided when attaching -- currently
attached scsi_dh name is determined with scsi_dh_attached_handler_name.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Tested-by: Babu Moger <babu.moger@netapp.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Chandra Seetharaman <sekharan@us.ibm.com>
---
drivers/md/dm-mpath.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
v3: updated to not kstrdup since scsi_dh_attached_handler_name now does
Index: linux-2.6/drivers/md/dm-mpath.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-mpath.c
+++ linux-2.6/drivers/md/dm-mpath.c
@@ -84,6 +84,7 @@ struct multipath {
unsigned queue_io:1; /* Must we queue all I/O? */
unsigned queue_if_no_path:1; /* Queue I/O if last path fails? */
unsigned saved_queue_if_no_path:1; /* Saved state during suspension */
+ unsigned use_default_hw_handler:1; /* Use attached device handler */
unsigned pg_init_retries; /* Number of times to retry pg_init */
unsigned pg_init_count; /* Number of times pg_init called */
@@ -567,6 +568,7 @@ static struct pgpath *parse_path(struct
int r;
struct pgpath *p;
struct multipath *m = ti->private;
+ struct request_queue *q = NULL;
/* we need at least a path arg */
if (as->argc < 1) {
@@ -585,9 +587,19 @@ static struct pgpath *parse_path(struct
goto bad;
}
- if (m->hw_handler_name) {
- struct request_queue *q = bdev_get_queue(p->path.dev->bdev);
+ if (m->use_default_hw_handler || m->hw_handler_name)
+ q = bdev_get_queue(p->path.dev->bdev);
+
+ if (m->use_default_hw_handler) {
+ const char *attached_handler_name =
+ scsi_dh_attached_handler_name(q, GFP_KERNEL);
+ if (attached_handler_name) {
+ kfree(m->hw_handler_name);
+ m->hw_handler_name = attached_handler_name;
+ }
+ }
+ if (m->hw_handler_name) {
r = scsi_dh_attach(q, m->hw_handler_name);
if (r == -EBUSY) {
/*
@@ -759,7 +771,7 @@ static int parse_features(struct dm_arg_
const char *arg_name;
static struct dm_arg _args[] = {
- {0, 5, "invalid number of feature args"},
+ {0, 6, "invalid number of feature args"},
{1, 50, "pg_init_retries must be between 1 and 50"},
{0, 60000, "pg_init_delay_msecs must be between 0 and 60000"},
};
@@ -780,6 +792,11 @@ static int parse_features(struct dm_arg_
continue;
}
+ if (!strcasecmp(arg_name, "default_hw_handler")) {
+ m->use_default_hw_handler = 1;
+ continue;
+ }
+
if (!strcasecmp(arg_name, "pg_init_retries") &&
(argc >= 1)) {
r = dm_read_arg(_args + 1, as, &m->pg_init_retries, &ti->error);
@@ -1363,13 +1380,16 @@ static int multipath_status(struct dm_ta
else {
DMEMIT("%u ", m->queue_if_no_path +
(m->pg_init_retries > 0) * 2 +
- (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT) * 2);
+ (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT) * 2 +
+ m->use_default_hw_handler);
if (m->queue_if_no_path)
DMEMIT("queue_if_no_path ");
if (m->pg_init_retries)
DMEMIT("pg_init_retries %u ", m->pg_init_retries);
if (m->pg_init_delay_msecs != DM_PG_INIT_DELAY_DEFAULT)
DMEMIT("pg_init_delay_msecs %u ", m->pg_init_delay_msecs);
+ if (m->use_default_hw_handler)
+ DMEMIT("default_hw_handler ");
}
if (!m->hw_handler_name || type == STATUSTYPE_INFO)
next prev parent reply other threads:[~2012-05-10 21:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-08 21:56 [PATCH v2 0/5] dm mpath: add 'default_hw_handler' and 'no_partitions' features Mike Snitzer
2012-05-08 21:56 ` [PATCH v2 1/5] dm mpath: only try to load the scsi_dh module if the scsi_dh doesn't exist Mike Snitzer
2012-05-09 6:57 ` Hannes Reinecke
2012-05-09 22:54 ` Chandra Seetharaman
2012-05-08 21:56 ` [PATCH v2 2/5] scsi_dh: add scsi_dh_attached_handler_name Mike Snitzer
2012-05-09 6:57 ` Hannes Reinecke
2012-05-09 17:40 ` Moger, Babu
2012-05-09 20:41 ` [PATCH v3 " Mike Snitzer
2012-05-09 20:41 ` Mike Snitzer
2012-05-09 22:54 ` Chandra Seetharaman
2012-05-09 22:54 ` Chandra Seetharaman
2012-05-08 21:56 ` [PATCH v2 3/5] dm mpath: reduce size of multipath structure Mike Snitzer
2012-05-09 6:58 ` Hannes Reinecke
2012-05-08 21:56 ` [PATCH v2 4/5] dm mpath: add 'default_hw_handler' feature Mike Snitzer
2012-05-09 18:10 ` Moger, Babu
2012-05-09 19:17 ` Mike Snitzer
2012-05-09 20:35 ` Moger, Babu
2012-05-09 23:02 ` Chandra Seetharaman
2012-05-10 21:31 ` Mike Snitzer [this message]
2012-05-17 21:15 ` [PATCH v3 " Chandra Seetharaman
2012-05-08 21:56 ` [PATCH v2 5/5] dm mpath: add ability to disable partition creation Mike Snitzer
2012-05-09 23:04 ` Chandra Seetharaman
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=20120510213147.GA5946@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=babu.moger@netapp.com \
--cc=dm-devel@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.