From: Benjamin Marzinski <bmarzins@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] multipath-tools: Add preferred TPG prioritizer
Date: Fri, 11 Sep 2009 13:23:09 -0500 [thread overview]
Message-ID: <20090911182308.GN15326@ether.msp.redhat.com> (raw)
Instead of using the Target port's Asymmetric Access State to determine
priority, some users what to use the preferred port bit. This patch makes
a new prioritizer, based off the ALUA prioritizer, but using the preferred
port bit instead.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/prio.h | 1 +
libmultipath/prioritizers/Makefile | 10 ++++++++++
libmultipath/prioritizers/alua.c | 7 +++++++
libmultipath/prioritizers/alua_rtpg.c | 4 ++++
libmultipath/prioritizers/alua_spc3.h | 6 ++++++
5 files changed, 28 insertions(+)
Index: multipath-tools-090902/libmultipath/prio.h
===================================================================
--- multipath-tools-090902.orig/libmultipath/prio.h
+++ multipath-tools-090902/libmultipath/prio.h
@@ -16,6 +16,7 @@
* Known prioritizers for use in hwtable.c
*/
#define PRIO_ALUA "alua"
+#define PRIO_TPG_PREF "tpg_pref"
#define PRIO_CONST "const"
#define PRIO_EMC "emc"
#define PRIO_HDS "hds"
Index: multipath-tools-090902/libmultipath/prioritizers/alua.c
===================================================================
--- multipath-tools-090902.orig/libmultipath/prioritizers/alua.c
+++ multipath-tools-090902/libmultipath/prioritizers/alua.c
@@ -28,6 +28,12 @@
int
get_alua_info(int fd)
{
+#ifdef TPG_PREF
+ char * aas_string[] = {
+ [AAS_OPTIMIZED] = "preferred",
+ [AAS_STANDBY] = "non-preferred",
+ };
+#else
char * aas_string[] = {
[AAS_OPTIMIZED] = "active/optimized",
[AAS_NON_OPTIMIZED] = "active/non-optimized",
@@ -35,6 +41,7 @@ get_alua_info(int fd)
[AAS_UNAVAILABLE] = "unavailable",
[AAS_TRANSITIONING] = "transitioning between states",
};
+#endif
int rc;
int tpg;
Index: multipath-tools-090902/libmultipath/prioritizers/alua_rtpg.c
===================================================================
--- multipath-tools-090902.orig/libmultipath/prioritizers/alua_rtpg.c
+++ multipath-tools-090902/libmultipath/prioritizers/alua_rtpg.c
@@ -293,7 +293,11 @@ get_asymmetric_access_state(int fd, unsi
"group.\n");
} else {
PRINT_DEBUG("pref=%i\n", dscr->b0);
+#ifdef TPG_PREF
+ rc = rtpg_tpg_dscr_get_pref(dscr);
+#else
rc = rtpg_tpg_dscr_get_aas(dscr);
+#endif
}
}
}
Index: multipath-tools-090902/libmultipath/prioritizers/alua_spc3.h
===================================================================
--- multipath-tools-090902.orig/libmultipath/prioritizers/alua_spc3.h
+++ multipath-tools-090902/libmultipath/prioritizers/alua_spc3.h
@@ -302,6 +302,12 @@ rtpg_tpg_dscr_get_aas(struct rtpg_tpg_ds
return (d->b0 & 0x0f);
}
+static inline int
+rtpg_tpg_dscr_get_pref(struct rtpg_tpg_dscr *d)
+{
+ return ((d->b0 & 0x80)?AAS_OPTIMIZED:AAS_STANDBY);
+}
+
struct rtpg_data {
unsigned char length[4]; /* size-4 */
struct rtpg_tpg_dscr data[0];
Index: multipath-tools-090902/libmultipath/prioritizers/Makefile
===================================================================
--- multipath-tools-090902.orig/libmultipath/prioritizers/Makefile
+++ multipath-tools-090902/libmultipath/prioritizers/Makefile
@@ -11,6 +11,7 @@ LIBS = \
libprioemc.so \
libpriordac.so \
libprioalua.so \
+ libpriotpg_pref.so \
libprionetapp.so \
libpriohds.so
@@ -21,9 +22,18 @@ all: $(LIBS)
libprioalua.so: alua.o alua_rtpg.o
$(CC) $(SHARED_FLAGS) -o $@ $^
+libpriotpg_pref.so: pref.o pref_rtpg.o
+ $(CC) $(SHARED_FLAGS) -o $@ $^
+
libprio%.so: %.o
$(CC) $(SHARED_FLAGS) -o $@ $^
+pref.o: alua.c
+ $(CC) $(CFLAGS) -DTPG_PREF -c -o $@ $<
+
+pref_rtpg.o: alua_rtpg.c
+ $(CC) $(CFLAGS) -DTPG_PREF -c -o $@ $<
+
install: $(LIBS)
$(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(libdir)
next reply other threads:[~2009-09-11 18:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-11 18:23 Benjamin Marzinski [this message]
2009-09-14 6:24 ` [PATCH] multipath-tools: Add preferred TPG prioritizer Hannes Reinecke
2009-09-14 15:59 ` Benjamin Marzinski
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=20090911182308.GN15326@ether.msp.redhat.com \
--to=bmarzins@redhat.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.