From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: Hannes Reinecke <hare@suse.com>, dm-devel@redhat.com
Subject: [PATCH 19/26] prio: use 'multipath_dir' as argument
Date: Mon, 20 Jun 2016 10:09:06 +0200 [thread overview]
Message-ID: <1466410153-23896-20-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1466410153-23896-1-git-send-email-hare@suse.de>
Pass in the 'multipath_dir' config setting as explicit argument
for init_prio() and prio_get().
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
libmultipath/prio.c | 24 ++++++++++++++++--------
libmultipath/prio.h | 6 +++---
libmultipath/propsel.c | 16 ++++++++--------
multipath/main.c | 2 +-
multipathd/main.c | 2 +-
5 files changed, 29 insertions(+), 21 deletions(-)
diff --git a/libmultipath/prio.c b/libmultipath/prio.c
index fbf3190..c37d1b0 100644
--- a/libmultipath/prio.c
+++ b/libmultipath/prio.c
@@ -17,9 +17,9 @@ unsigned int get_prio_timeout(unsigned int default_timeout)
return default_timeout;
}
-int init_prio (void)
+int init_prio (char *multipath_dir)
{
- if (!add_prio(DEFAULT_PRIO))
+ if (!add_prio(multipath_dir, DEFAULT_PRIO))
return 1;
return 0;
}
@@ -78,7 +78,7 @@ struct prio * prio_lookup (char * name)
if (!strncmp(name, p->name, PRIO_NAME_LEN))
return p;
}
- return add_prio(name);
+ return NULL;
}
int prio_set_args (struct prio * p, char * args)
@@ -86,7 +86,7 @@ int prio_set_args (struct prio * p, char * args)
return snprintf(p->args, PRIO_ARGS_LEN, "%s", args);
}
-struct prio * add_prio (char * name)
+struct prio * add_prio (char *multipath_dir, char * name)
{
char libname[LIB_PRIO_NAMELEN];
struct stat stbuf;
@@ -98,10 +98,10 @@ struct prio * add_prio (char * name)
return NULL;
snprintf(p->name, PRIO_NAME_LEN, "%s", name);
snprintf(libname, LIB_PRIO_NAMELEN, "%s/libprio%s.so",
- conf->multipath_dir, name);
+ multipath_dir, name);
if (stat(libname,&stbuf) < 0) {
condlog(0,"Prioritizer '%s' not found in %s",
- name, conf->multipath_dir);
+ name, multipath_dir);
goto out;
}
condlog(3, "loading %s prioritizer", libname);
@@ -147,10 +147,18 @@ char * prio_args (struct prio * p)
return p->args;
}
-void prio_get (struct prio * dst, char * name, char * args)
+void prio_get (char *multipath_dir, struct prio * dst, char * name, char * args)
{
- struct prio * src = prio_lookup(name);
+ struct prio * src = NULL;
+
+ if (!dst)
+ return;
+ if (name && strlen(name)) {
+ src = prio_lookup(name);
+ if (!src)
+ src = add_prio(multipath_dir, name);
+ }
if (!src) {
dst->getprio = NULL;
return;
diff --git a/libmultipath/prio.h b/libmultipath/prio.h
index 258dee7..ce72a54 100644
--- a/libmultipath/prio.h
+++ b/libmultipath/prio.h
@@ -53,12 +53,12 @@ struct prio {
};
unsigned int get_prio_timeout(unsigned int default_timeout);
-int init_prio (void);
+int init_prio (char *);
void cleanup_prio (void);
-struct prio * add_prio (char *);
+struct prio * add_prio (char *, char *);
struct prio * prio_lookup (char *);
int prio_getprio (struct prio *, struct path *);
-void prio_get (struct prio *, char *, char *);
+void prio_get (char *, struct prio *, char *, char *);
void prio_put (struct prio *);
int prio_selected (struct prio *);
char * prio_name (struct prio *);
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index c1f3d4e..a97e80f 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -383,13 +383,13 @@ detect_prio(struct path * pp)
return;
if (get_asymmetric_access_state(pp->fd, ret) < 0)
return;
- prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
+ prio_get(conf->multipath_dir, p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
}
-#define set_prio(src, msg) \
+#define set_prio(dir, src, msg) \
do { \
if (src && src->prio_name) { \
- prio_get(p, src->prio_name, src->prio_args); \
+ prio_get(dir, p, src->prio_name, src->prio_args); \
origin = msg; \
goto out; \
} \
@@ -410,11 +410,11 @@ select_prio (struct path * pp)
}
}
mpe = find_mpe(conf->hwtable, pp->wwid);
- set_prio(mpe, "(LUN setting)");
- set_prio(conf->overrides, "(overrides setting)");
- set_prio(pp->hwe, "controller setting)");
- set_prio(conf, "(config file default)");
- prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS);
+ set_prio(conf->multipath_dir, mpe, "(LUN setting)");
+ set_prio(conf->multipath_dir, conf->overrides, "(overrides setting)");
+ set_prio(conf->multipath_dir, pp->hwe, "controller setting)");
+ set_prio(conf->multipath_dir, conf, "(config file default)");
+ prio_get(conf->multipath_dir, p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS);
origin = "(internal default)";
out:
/*
diff --git a/multipath/main.c b/multipath/main.c
index 70412a8..a6f593f 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -626,7 +626,7 @@ main (int argc, char *argv[])
condlog(0, "failed to initialize checkers");
goto out;
}
- if (init_prio()) {
+ if (init_prio(conf->multipath_dir)) {
condlog(0, "failed to initialize prioritizers");
goto out;
}
diff --git a/multipathd/main.c b/multipathd/main.c
index 09b96c6..a076f71 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2114,7 +2114,7 @@ child (void * param)
condlog(0, "failed to initialize checkers");
goto failed;
}
- if (init_prio()) {
+ if (init_prio(conf->multipath_dir)) {
condlog(0, "failed to initialize prioritizers");
goto failed;
}
--
2.6.6
next prev parent reply other threads:[~2016-06-20 8:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 8:08 [PATCH 00/26] Userspace-RCU for config accesses Hannes Reinecke
2016-06-20 8:08 ` [PATCH 01/26] Revert patch 'move filter_devnode() under vector lock' Hannes Reinecke
2016-06-20 8:08 ` [PATCH 02/26] Use 'mptable' as argument for find_mpe() and get_mpe_wwid() Hannes Reinecke
2016-07-01 19:48 ` Benjamin Marzinski
2016-06-20 8:08 ` [PATCH 03/26] config: set 'deferred_remove' defaults at correct call Hannes Reinecke
2016-06-20 8:08 ` [PATCH 04/26] devmapper: explicit config settings Hannes Reinecke
2016-06-20 8:08 ` [PATCH 05/26] dmparser: use 'is_daemon' as argument for disassemble_map() Hannes Reinecke
2016-06-20 8:08 ` [PATCH 06/26] libmultipath: use 'is_daemon' as argument for domap() etc Hannes Reinecke
2016-06-20 8:08 ` [PATCH 07/26] libmultipath: drop 'daemon' configuration setting Hannes Reinecke
2016-06-20 8:08 ` [PATCH 08/26] libmultipath: Do not access 'conf->cmd' in domap() Hannes Reinecke
2016-06-20 8:08 ` [PATCH 09/26] libmultipath: add 'cmd' as argument for get_refwwid() Hannes Reinecke
2016-06-20 8:08 ` [PATCH 10/26] libmultipath: fallback to checking environment variable in get_udev_uid() Hannes Reinecke
2016-06-20 8:08 ` [PATCH 11/26] multipath: make 'cmd' internal to multipath program Hannes Reinecke
2016-06-20 8:08 ` [PATCH 12/26] multipath: make 'dev_type' internal to the " Hannes Reinecke
2016-06-20 8:09 ` [PATCH 13/26] multipath: make 'dev' " Hannes Reinecke
2016-06-20 8:09 ` [PATCH 14/26] libmultipath: separate out 'udev' config entry Hannes Reinecke
2016-06-20 8:09 ` [PATCH 15/26] libmultipath: use 'checkint' as argument for sysfs_set_scsi_tmo() Hannes Reinecke
2016-06-20 8:09 ` [PATCH 16/26] discovery: Pass in 'hwtable' for get_state() and scsi_sysfs_discovery() Hannes Reinecke
2016-06-20 8:09 ` [PATCH 17/26] libmultipath: use 'struct config' as argument for pathinfo() Hannes Reinecke
2016-07-01 20:25 ` Benjamin Marzinski
2016-07-04 5:49 ` Hannes Reinecke
2016-06-20 8:09 ` [PATCH 18/26] checkers: use 'multipath_dir' as argument Hannes Reinecke
2016-06-20 8:09 ` Hannes Reinecke [this message]
2016-06-20 8:09 ` [PATCH 20/26] libmultipath: use 'timeout' as argument for getprio() Hannes Reinecke
2016-06-20 8:09 ` [PATCH 21/26] libmultipath: use explicit 'config' argument for configuration file parsing Hannes Reinecke
2016-06-20 8:09 ` [PATCH 22/26] libmultipath: use (get, put)_multipath_config() accessors Hannes Reinecke
2016-06-20 8:09 ` [PATCH 23/26] multipathd: Fixup commandline argument handling Hannes Reinecke
2016-06-20 8:09 ` [PATCH 24/26] multipath: make 'struct config' a local variable Hannes Reinecke
2016-06-20 8:09 ` [PATCH 25/26] multipathd: use userspace RCU to access configuration Hannes Reinecke
2016-06-20 8:09 ` [PATCH 26/26] libmultipath: Allocate keywords directly Hannes Reinecke
2016-07-01 20:44 ` [PATCH 00/26] Userspace-RCU for config accesses Benjamin Marzinski
-- strict thread matches above, loose matches on Subject: below --
2016-07-04 7:08 [PATCHv2 " Hannes Reinecke
2016-07-04 7:08 ` [PATCH 19/26] prio: use 'multipath_dir' as argument Hannes Reinecke
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=1466410153-23896-20-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).