d88bf6
---
d88bf6
 multipathd/cli.c          |    2 ++
d88bf6
 multipathd/cli_handlers.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
d88bf6
 multipathd/cli_handlers.h |    2 ++
d88bf6
 multipathd/main.c         |    2 ++
45d01a
 multipathd/multipathd.8   |    6 ++++++
45d01a
 5 files changed, 56 insertions(+)
d88bf6
d88bf6
Index: multipath-tools-130222/multipathd/cli.c
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/multipathd/cli.c
d88bf6
+++ multipath-tools-130222/multipathd/cli.c
d88bf6
@@ -482,6 +482,8 @@ cli_init (void) {
d88bf6
 	add_handler(LIST+BLACKLIST, NULL);
d88bf6
 	add_handler(LIST+DEVICES, NULL);
d88bf6
 	add_handler(LIST+WILDCARDS, NULL);
d88bf6
+	add_handler(RESET+MAPS+STATS, NULL);
d88bf6
+	add_handler(RESET+MAP+STATS, NULL);
d88bf6
 	add_handler(ADD+PATH, NULL);
d88bf6
 	add_handler(DEL+PATH, NULL);
d88bf6
 	add_handler(ADD+MAP, NULL);
d88bf6
Index: multipath-tools-130222/multipathd/cli_handlers.c
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
d88bf6
+++ multipath-tools-130222/multipathd/cli_handlers.c
d88bf6
@@ -233,6 +233,17 @@ show_config (char ** r, int * len)
d88bf6
 	return 0;
d88bf6
 }
d88bf6
 
d88bf6
+void
d88bf6
+reset_stats(struct multipath * mpp)
d88bf6
+{
d88bf6
+	mpp->stat_switchgroup = 0;
d88bf6
+	mpp->stat_path_failures = 0;
d88bf6
+	mpp->stat_map_loads = 0;
d88bf6
+	mpp->stat_total_queueing_time = 0;
d88bf6
+	mpp->stat_queueing_timeouts = 0;
d88bf6
+	mpp->stat_map_failures = 0;
d88bf6
+}
d88bf6
+
d88bf6
 int
d88bf6
 cli_list_config (void * v, char ** reply, int * len, void * data)
d88bf6
 {
d88bf6
@@ -501,6 +512,39 @@ cli_list_daemon (void * v, char ** reply
d88bf6
 }
d88bf6
 
d88bf6
 int
d88bf6
+cli_reset_maps_stats (void * v, char ** reply, int * len, void * data)
d88bf6
+{
d88bf6
+	struct vectors * vecs = (struct vectors *)data;
d88bf6
+	int i;
d88bf6
+	struct multipath * mpp;
d88bf6
+
d88bf6
+	condlog(3, "reset multipaths stats (operator)");
d88bf6
+
d88bf6
+	vector_foreach_slot(vecs->mpvec, mpp, i) {
d88bf6
+		reset_stats(mpp);
d88bf6
+	}
d88bf6
+	return 0;
d88bf6
+}
d88bf6
+
d88bf6
+int
d88bf6
+cli_reset_map_stats (void * v, char ** reply, int * len, void * data)
d88bf6
+{
d88bf6
+	struct vectors * vecs = (struct vectors *)data;
d88bf6
+	struct multipath * mpp;
d88bf6
+	char * param = get_keyparam(v, MAP);
d88bf6
+
d88bf6
+	param = convert_dev(param, 0);
d88bf6
+	mpp = find_mp_by_str(vecs->mpvec, param);
d88bf6
+
d88bf6
+	if (!mpp)
d88bf6
+		return 1;
d88bf6
+
d88bf6
+	condlog(3, "reset multipath %s stats (operator)", param);
d88bf6
+	reset_stats(mpp);
d88bf6
+	return 0;
d88bf6
+}
d88bf6
+
d88bf6
+int
d88bf6
 cli_add_path (void * v, char ** reply, int * len, void * data)
d88bf6
 {
d88bf6
 	struct vectors * vecs = (struct vectors *)data;
d88bf6
Index: multipath-tools-130222/multipathd/cli_handlers.h
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/multipathd/cli_handlers.h
d88bf6
+++ multipath-tools-130222/multipathd/cli_handlers.h
d88bf6
@@ -16,6 +16,8 @@ int cli_list_config (void * v, char ** r
d88bf6
 int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
d88bf6
 int cli_list_devices (void * v, char ** reply, int * len, void * data);
d88bf6
 int cli_list_wildcards (void * v, char ** reply, int * len, void * data);
d88bf6
+int cli_reset_maps_stats (void * v, char ** reply, int * len, void * data);
d88bf6
+int cli_reset_map_stats (void * v, char ** reply, int * len, void * data);
d88bf6
 int cli_add_path (void * v, char ** reply, int * len, void * data);
d88bf6
 int cli_del_path (void * v, char ** reply, int * len, void * data);
d88bf6
 int cli_add_map (void * v, char ** reply, int * len, void * data);
d88bf6
Index: multipath-tools-130222/multipathd/main.c
d88bf6
===================================================================
d88bf6
--- multipath-tools-130222.orig/multipathd/main.c
d88bf6
+++ multipath-tools-130222/multipathd/main.c
d88bf6
@@ -1011,6 +1011,8 @@ uxlsnrloop (void * ap)
d88bf6
 	set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
d88bf6
 	set_handler_callback(LIST+DEVICES, cli_list_devices);
d88bf6
 	set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
d88bf6
+	set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
d88bf6
+	set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
d88bf6
 	set_handler_callback(ADD+PATH, cli_add_path);
d88bf6
 	set_handler_callback(DEL+PATH, cli_del_path);
d88bf6
 	set_handler_callback(ADD+MAP, cli_add_map);
45d01a
Index: multipath-tools-130222/multipathd/multipathd.8
45d01a
===================================================================
45d01a
--- multipath-tools-130222.orig/multipathd/multipathd.8
45d01a
+++ multipath-tools-130222/multipathd/multipathd.8
45d01a
@@ -87,6 +87,12 @@ Show all available block devices by name
45d01a
 .B list|show status
45d01a
 Show the number of path checkers in each possible state, the number of monitored paths, and whether multipathd is currently handling a uevent.
45d01a
 .TP
45d01a
+.B reset maps|multipaths stats
45d01a
+Reset the stat counters for all multipath devices.
45d01a
+.TP
45d01a
+.B reset map|multipath $map stats
45d01a
+Reset the stat counters for a specific multipath device.
45d01a
+.TP
45d01a
 .B add path $path
45d01a
 Add a path to the list of monitored paths. $path is as listed in /sys/block (e.g. sda).
45d01a
 .TP