On 12/19/18 12:19 AM, Martin Wilck wrote:
From: lijie <lijie34@xxxxxxxxxx>
Add support for Asynchronous Namespace Access as specified in NVMe 1.3
TP 4004. The states are updated through reading the ANA log page.
By default, the native nvme multipath takes over the nvme device.
We can pass a false to the parameter 'multipath' of the nvme-core.ko
module,when we want to use multipath-tools.
Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
libmultipath/prio.h | 1 +
libmultipath/prioritizers/Makefile | 1 +
libmultipath/prioritizers/ana.c | 292 +++++++++++++++++++++++++++++
libmultipath/prioritizers/ana.h | 221 ++++++++++++++++++++++
multipath/multipath.conf.5 | 8 +
5 files changed, 523 insertions(+)
create mode 100644 libmultipath/prioritizers/ana.c
create mode 100644 libmultipath/prioritizers/ana.h
diff --git a/libmultipath/prio.h b/libmultipath/prio.h
index aa587ccd..599d1d88 100644
--- a/libmultipath/prio.h
+++ b/libmultipath/prio.h
@@ -30,6 +30,7 @@ struct path;
#define PRIO_WEIGHTED_PATH "weightedpath"
#define PRIO_SYSFS "sysfs"
#define PRIO_PATH_LATENCY "path_latency"
+#define PRIO_ANA "ana"
/*
* Value used to mark the fact prio was not defined
diff --git a/libmultipath/prioritizers/Makefile b/libmultipath/prioritizers/Makefile
index ab7bc075..15afaba3 100644
--- a/libmultipath/prioritizers/Makefile
+++ b/libmultipath/prioritizers/Makefile
@@ -19,6 +19,7 @@ LIBS = \
libpriordac.so \
libprioweightedpath.so \
libpriopath_latency.so \
+ libprioana.so \
libpriosysfs.so
all: $(LIBS)
diff --git a/libmultipath/prioritizers/ana.c b/libmultipath/prioritizers/ana.c
new file mode 100644
index 00000000..c5aaa5fb
--- /dev/null
+++ b/libmultipath/prioritizers/ana.c
@@ -0,0 +1,292 @@
+/*
+ * (C) Copyright HUAWEI Technology Corp. 2017 All Rights Reserved.
+ *
+ * ana.c
+ * Version 1.00
+ *
+ * Tool to make use of a NVMe-feature called Asymmetric Namespace Access.
+ * It determines the ANA state of a device and prints a priority value to stdout.
+ *
+ * Author(s): Cheng Jike <chengjike.cheng@xxxxxxxxxx>
+ * Li Jie <lijie34@xxxxxxxxxx>
+ *
+ * This file is released under the GPL version 2, or any later version.
+ */
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <stdbool.h>
+
+#include "debug.h"
+#include "prio.h"
+#include "structs.h"
+#include "ana.h"
+
+enum {
+ ANA_PRIO_OPTIMIZED = 50,
+ ANA_PRIO_NONOPTIMIZED = 10,
+ ANA_PRIO_INACCESSIBLE = 5,
+ ANA_PRIO_PERSISTENT_LOSS = 1,
+ ANA_PRIO_CHANGE = 0,
+ ANA_PRIO_RESERVED = 0,
+ ANA_PRIO_GETCTRL_FAILED = -1,
+ ANA_PRIO_NOT_SUPPORTED = -2,
+ ANA_PRIO_GETANAS_FAILED = -3,
+ ANA_PRIO_GETANALOG_FAILED = -4,
+ ANA_PRIO_GETNSID_FAILED = -5,
+ ANA_PRIO_GETNS_FAILED = -6,
+ ANA_PRIO_NO_MEMORY = -7,
+ ANA_PRIO_NO_INFORMATION = -8,
+};
Please model the priorities according to the ALUA handler; ANA state
'persistent loss' maps onto ALUA 'unavailable' (and hence should have a
priority of '0'), and ANA state 'inaccessible' is roughly similar to
ALUA 'standby', hence should have a priority of '1'.
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@xxxxxxx +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel