[lustre-devel] [PATCH 26/26] lnet: add "stats reset" to lnetctl

James Simmons jsimmons at infradead.org
Mon Aug 2 12:50:51 PDT 2021


From: Cyril Bordage <cbordage at whamcloud.com>

This new command resets stats shown by "lnetctl stats show". It could
be useful when debugging connectivity issues, by making easier the
process to detect the changes in stats from the clean state rather
than on top of historical values.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13299
Lustre-commit: db0b09018e771146 ("LU-13299 lnet: add "stats reset" to lnetctl")
Signed-off-by: Cyril Bordage <cbordage at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44150
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Amir Shehata <ashehata at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 include/uapi/linux/lnet/libcfs_ioctl.h | 3 ++-
 net/lnet/lnet/api-ni.c                 | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/lnet/libcfs_ioctl.h b/include/uapi/linux/lnet/libcfs_ioctl.h
index 2c900ef..7b1c880 100644
--- a/include/uapi/linux/lnet/libcfs_ioctl.h
+++ b/include/uapi/linux/lnet/libcfs_ioctl.h
@@ -155,6 +155,7 @@ struct libcfs_ioctl_data {
 #define IOC_LIBCFS_GET_UDSP_SIZE	_IOWR(IOC_LIBCFS_TYPE, 107, IOCTL_CONFIG_SIZE)
 #define IOC_LIBCFS_GET_UDSP		_IOWR(IOC_LIBCFS_TYPE, 108, IOCTL_CONFIG_SIZE)
 #define IOC_LIBCFS_GET_CONST_UDSP_INFO	_IOWR(IOC_LIBCFS_TYPE, 109, IOCTL_CONFIG_SIZE)
-#define IOC_LIBCFS_MAX_NR				       109
+#define IOC_LIBCFS_RESET_LNET_STATS	_IOWR(IOC_LIBCFS_TYPE, 110, IOCTL_CONFIG_SIZE)
+#define IOC_LIBCFS_MAX_NR				       110
 
 #endif /* __LIBCFS_IOCTL_H__ */
diff --git a/net/lnet/lnet/api-ni.c b/net/lnet/lnet/api-ni.c
index 4513d8d..c7df936 100644
--- a/net/lnet/lnet/api-ni.c
+++ b/net/lnet/lnet/api-ni.c
@@ -3886,6 +3886,14 @@ u32 lnet_get_dlc_seq_locked(void)
 		return rc;
 	}
 
+	case IOC_LIBCFS_RESET_LNET_STATS:
+	{
+		mutex_lock(&the_lnet.ln_api_mutex);
+		lnet_counters_reset();
+		mutex_unlock(&the_lnet.ln_api_mutex);
+		return 0;
+	}
+
 	case IOC_LIBCFS_CONFIG_RTR:
 		config = arg;
 
-- 
1.8.3.1



More information about the lustre-devel mailing list