]>
Commit | Line | Data |
---|---|---|
dc01aad8 SS |
1 | From faf6bfc96b98562626e0ea12aecb582032ff4cab Mon Sep 17 00:00:00 2001 |
2 | From: Fabio M. Di Nitto <fdinitto@redhat.com> | |
3 | Date: Mon, 19 Oct 2009 07:02:02 +0200 | |
4 | Subject: [PATCH 1/1] for-upstream: add tpg_pref prioritizer | |
5 | ||
6 | Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> | |
7 | --- | |
8 | :100644 100644 fc9277f... 1f40859... M libmultipath/prio.h | |
9 | :100644 100644 949a60a... 5021c04... M libmultipath/prioritizers/Makefile | |
10 | :100644 100644 0048a44... 22513ab... M libmultipath/prioritizers/alua.c | |
11 | :100644 100644 0531052... cd9c29d... M libmultipath/prioritizers/alua_rtpg.c | |
12 | :100644 100644 bddbbdd... daf95a6... M libmultipath/prioritizers/alua_spc3.h | |
13 | libmultipath/prio.h | 1 + | |
14 | libmultipath/prioritizers/Makefile | 10 ++++++++++ | |
15 | libmultipath/prioritizers/alua.c | 7 +++++++ | |
16 | libmultipath/prioritizers/alua_rtpg.c | 4 ++++ | |
17 | libmultipath/prioritizers/alua_spc3.h | 6 ++++++ | |
18 | 5 files changed, 28 insertions(+), 0 deletions(-) | |
19 | ||
20 | diff --git a/libmultipath/prio.h b/libmultipath/prio.h | |
21 | index fc9277f..1f40859 100644 | |
22 | --- a/libmultipath/prio.h | |
23 | +++ b/libmultipath/prio.h | |
24 | @@ -16,6 +16,7 @@ | |
25 | * Known prioritizers for use in hwtable.c | |
26 | */ | |
27 | #define PRIO_ALUA "alua" | |
28 | +#define PRIO_TPG_PREF "tpg_pref" | |
29 | #define PRIO_CONST "const" | |
30 | #define PRIO_EMC "emc" | |
31 | #define PRIO_HDS "hds" | |
32 | diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile | |
33 | index 949a60a..5021c04 100644 | |
34 | --- a/libmultipath/prioritizers/Makefile | |
35 | +++ b/libmultipath/prioritizers/Makefile | |
36 | @@ -11,6 +11,7 @@ LIBS = \ | |
37 | libprioemc.so \ | |
38 | libpriordac.so \ | |
39 | libprioalua.so \ | |
40 | + libpriotpg_pref.so \ | |
41 | libprionetapp.so \ | |
42 | libpriohds.so | |
43 | ||
44 | @@ -21,9 +22,18 @@ all: $(LIBS) | |
45 | libprioalua.so: alua.o alua_rtpg.o | |
46 | $(CC) $(SHARED_FLAGS) -o $@ $^ | |
47 | ||
48 | +libpriotpg_pref.so: pref.o pref_rtpg.o | |
49 | + $(CC) $(SHARED_FLAGS) -o $@ $^ | |
50 | + | |
51 | libprio%.so: %.o | |
52 | $(CC) $(SHARED_FLAGS) -o $@ $^ | |
53 | ||
54 | +pref.o: alua.c | |
55 | + $(CC) $(CFLAGS) -DTPG_PREF -c -o $@ $< | |
56 | + | |
57 | +pref_rtpg.o: alua_rtpg.c | |
58 | + $(CC) $(CFLAGS) -DTPG_PREF -c -o $@ $< | |
59 | + | |
60 | install: $(LIBS) | |
61 | $(INSTALL_PROGRAM) -m 755 libprio*.so $(DESTDIR)$(libdir) | |
62 | ||
63 | diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c | |
64 | index 0048a44..22513ab 100644 | |
65 | --- a/libmultipath/prioritizers/alua.c | |
66 | +++ b/libmultipath/prioritizers/alua.c | |
67 | @@ -28,6 +28,12 @@ | |
68 | int | |
69 | get_alua_info(int fd) | |
70 | { | |
71 | +#ifdef TPG_PREF | |
72 | + char * aas_string[] = { | |
73 | + [AAS_OPTIMIZED] = "preferred", | |
74 | + [AAS_STANDBY] = "non-preferred", | |
75 | + }; | |
76 | +#else | |
77 | char * aas_string[] = { | |
78 | [AAS_OPTIMIZED] = "active/optimized", | |
79 | [AAS_NON_OPTIMIZED] = "active/non-optimized", | |
80 | @@ -35,6 +41,7 @@ get_alua_info(int fd) | |
81 | [AAS_UNAVAILABLE] = "unavailable", | |
82 | [AAS_TRANSITIONING] = "transitioning between states", | |
83 | }; | |
84 | +#endif | |
85 | int rc; | |
86 | int tpg; | |
87 | ||
88 | diff --git a/libmultipath/prioritizers/alua_rtpg.c b/libmultipath/prioritizers/alua_rtpg.c | |
89 | index 0531052..cd9c29d 100644 | |
90 | --- a/libmultipath/prioritizers/alua_rtpg.c | |
91 | +++ b/libmultipath/prioritizers/alua_rtpg.c | |
92 | @@ -293,7 +293,11 @@ get_asymmetric_access_state(int fd, unsigned int tpg) | |
93 | "group.\n"); | |
94 | } else { | |
95 | PRINT_DEBUG("pref=%i\n", dscr->b0); | |
96 | +#ifdef TPG_PREF | |
97 | + rc = rtpg_tpg_dscr_get_pref(dscr); | |
98 | +#else | |
99 | rc = rtpg_tpg_dscr_get_aas(dscr); | |
100 | +#endif | |
101 | } | |
102 | } | |
103 | } | |
104 | diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h | |
105 | index bddbbdd..daf95a6 100644 | |
106 | --- a/libmultipath/prioritizers/alua_spc3.h | |
107 | +++ b/libmultipath/prioritizers/alua_spc3.h | |
108 | @@ -302,6 +302,12 @@ rtpg_tpg_dscr_get_aas(struct rtpg_tpg_dscr *d) | |
109 | return (d->b0 & 0x0f); | |
110 | } | |
111 | ||
112 | +static inline int | |
113 | +rtpg_tpg_dscr_get_pref(struct rtpg_tpg_dscr *d) | |
114 | +{ | |
115 | + return ((d->b0 & 0x80)?AAS_OPTIMIZED:AAS_STANDBY); | |
116 | +} | |
117 | + | |
118 | struct rtpg_data { | |
119 | unsigned char length[4]; /* size-4 */ | |
120 | struct rtpg_tpg_dscr data[0]; | |
121 | -- | |
122 | 1.6.5.1 | |
123 |