From: Oleg Drokin Date: Tue, 22 Aug 2017 17:22:02 +0000 (-0400) Subject: LU-8066 lnet: port lnet router to debugfs X-Git-Tag: 2.10.54~10 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F26430%2F8;p=fs%2Flustre-release.git LU-8066 lnet: port lnet router to debugfs Move all the lnet procfs variables to debugfs. Linux-commit: b03f395a3e9bf4874fb58f4fe6033866d3b9f105 This brings the OpenSFS branch into sync with upstream lustre client. Technically debugfs is the not the proper place for stats but due to the upstream client being uses for production systems we have to keep them :-( New work will be done in the future to properly handle stats using sysfs instead. Test-Parameters: trivial envdefinitions=ONLY=215 testlist=sanity Change-Id: Id9244d8525f0844d321f29af4a01e1fbce8e5884 Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/26430 Reviewed-by: Olaf Weber Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index 4e3f09c..cfa00d6 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -570,8 +570,8 @@ extern int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, extern int lnet_get_peer_list(__u32 *countp, __u32 *sizep, lnet_process_id_t __user *ids); -void lnet_proc_init(void); -void lnet_proc_fini(void); +void lnet_router_debugfs_init(void); +void lnet_router_debugfs_fini(void); int lnet_rtrpools_alloc(int im_a_router); void lnet_destroy_rtrbuf(struct lnet_rtrbuf *rb, int npages); int lnet_rtrpools_adjust(int tiny, int small, int large); diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 2852fd8..dbcc44a 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2227,7 +2227,7 @@ LNetNIInit(lnet_pid_t requested_pid) goto err_destroy_push_target; lnet_fault_init(); - lnet_proc_init(); + lnet_router_debugfs_init(); mutex_unlock(&the_lnet.ln_api_mutex); @@ -2285,7 +2285,7 @@ LNetNIFini() lnet_fault_fini(); - lnet_proc_fini(); + lnet_router_debugfs_init(); lnet_peer_discovery_stop(); lnet_push_target_fini(); lnet_router_checker_stop(); diff --git a/lnet/lnet/router_proc.c b/lnet/lnet/router_proc.c index f9d8d36..c71571a 100644 --- a/lnet/lnet/router_proc.c +++ b/lnet/lnet/router_proc.c @@ -27,8 +27,6 @@ /* This is really lnet_proc.c. You might need to update sanity test 215 * if any file format is changed. */ -static struct ctl_table_header *lnet_table_header = NULL; - #define LNET_LOFFT_BITS (sizeof(loff_t) * 8) /* * NB: max allowed LNET_CPT_BITS is 8 on 64-bit system and 2 on 32-bit system @@ -955,34 +953,7 @@ static struct ctl_table lnet_table[] = { { 0 } }; -static struct ctl_table top_table[] = { - { - INIT_CTL_NAME - .procname = "lnet", - .mode = 0555, - .data = NULL, - .maxlen = 0, - .child = lnet_table, - }, - { 0 } -}; - -void -lnet_proc_init(void) +void lnet_router_debugfs_init(void) { -#ifdef CONFIG_SYSCTL - if (lnet_table_header == NULL) - lnet_table_header = register_sysctl_table(top_table); -#endif -} - -void -lnet_proc_fini(void) -{ -#ifdef CONFIG_SYSCTL - if (lnet_table_header != NULL) - unregister_sysctl_table(lnet_table_header); - - lnet_table_header = NULL; -#endif + lnet_insert_debugfs(lnet_table, NULL); } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 628cf5b..a2a82bc 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12616,16 +12616,12 @@ run_test 214 "hash-indexed directory test - bug 20133" # having "abc" as 1st arg, creates $TMP/lnet_abc.out and $TMP/lnet_abc.sys create_lnet_proc_files() { - lctl get_param -n $1 >$TMP/lnet_$1.out || error "cannot read lnet.$1" - sysctl lnet.$1 >$TMP/lnet_$1.sys_tmp || error "cannot read lnet.$1" - - sed "s/^lnet.$1\ =\ //g" "$TMP/lnet_$1.sys_tmp" >$TMP/lnet_$1.sys - rm -f "$TMP/lnet_$1.sys_tmp" + lctl get_param -n $1 >$TMP/lnet_$1.sys || error "cannot read lnet.$1" } # counterpart of create_lnet_proc_files remove_lnet_proc_files() { - rm -f $TMP/lnet_$1.out $TMP/lnet_$1.sys + rm -f $TMP/lnet_$1.sys } # uses 1st arg as trailing part of filename, 2nd arg as description for reports, @@ -12735,7 +12731,6 @@ test_215() { # for bugs 18102, 21079, 21517 # can we successfully write to lnet.stats? lctl set_param -n stats=0 || error "cannot write to lnet.stats" - sysctl -w lnet.stats=0 || error "cannot write to lnet.stats" } run_test 215 "lnet exists and has proper content - bugs 18102, 21079, 21517"