Whamcloud - gitweb
LU-17005 obdclass: allow stats header to be disabled
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 31 Jul 2023 17:53:22 +0000 (11:53 -0600)
committerAndreas Dilger <adilger@whamcloud.com>
Tue, 1 Aug 2023 22:03:27 +0000 (22:03 +0000)
Add a global "enable_stats_header" tunable parameter that can be
set to enable/disable the "start_time" and "elapsed_time" fields
in the standard lprocfs "stats" files.

Default to disabled for EXA6.2.1, since this is new for this release.

Lustre-change: https://review.whamcloud.com/51823
Lustre-commit: TBD (from 370a81bf07f3e3856f73900f276495fb7a2b5223)

Test-Parameters: trivial
Fixes: 5efb892396e3 ("LU-11407 obdclass: add start time to stats files")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I460b957447bfb83e6d4fd7395b79ce994f3ebbe5
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51824
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Feng Lei <flei@whamcloud.com>
lustre/include/lprocfs_status.h
lustre/obdclass/lprocfs_status.c
lustre/obdclass/obd_sysfs.c
lustre/tests/sanity.sh

index 46b2c7c..ba17bf5 100644 (file)
@@ -572,6 +572,7 @@ extern int lprocfs_obd_seq_create(struct obd_device *obd, const char *name,
 extern void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
                                 ktime_t ts_init, int width, const char *colon,
                                 bool show_units, const char *prefix);
+extern unsigned int obd_enable_stats_header;
 
 /* Generic callbacks */
 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
index 2411469..4df7d85 100644 (file)
@@ -41,6 +41,9 @@
 
 #ifdef CONFIG_PROC_FS
 
+/* disable start/elapsed_time in stats headers by default for compatibility */
+unsigned int obd_enable_stats_header;
+
 static int lprocfs_no_percpu_stats = 0;
 module_param(lprocfs_no_percpu_stats, int, 0644);
 MODULE_PARM_DESC(lprocfs_no_percpu_stats, "Do not alloc percpu data for lprocfs stats");
@@ -1407,6 +1410,9 @@ void lprocfs_stats_header(struct seq_file *seq, ktime_t now,
        seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
                   (s64)ts.tv_sec, ts.tv_nsec, units);
 
+       if (!obd_enable_stats_header)
+               return;
+
        field = (colon && colon[0]) ? "start_time:" : "start_time";
        ts = ktime_to_timespec64(ts_init);
        seq_printf(seq, "%s%-*s %llu.%09lu%s\n", prefix, width, field,
index 8e4cae2..fb48554 100644 (file)
@@ -121,6 +121,7 @@ LUSTRE_STATIC_UINT_ATTR(at_max, &at_max);
 LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra);
 LUSTRE_STATIC_UINT_ATTR(at_early_margin, &at_early_margin);
 LUSTRE_STATIC_UINT_ATTR(at_history, &at_history);
+LUSTRE_STATIC_UINT_ATTR(enable_stats_header, &obd_enable_stats_header);
 LUSTRE_STATIC_UINT_ATTR(lbug_on_eviction, &obd_lbug_on_eviction);
 
 #ifdef HAVE_SERVER_SUPPORT
@@ -399,6 +400,7 @@ LUSTRE_RW_ATTR(jobid_this_session);
 static struct attribute *lustre_attrs[] = {
        &lustre_attr_version.attr,
        &lustre_attr_pinger.attr,
+       &lustre_sattr_enable_stats_header.u.attr,
        &lustre_attr_health_check.attr,
        &lustre_attr_jobid_name.attr,
        &lustre_attr_jobid_var.attr,
index 93052ff..a6ac318 100755 (executable)
@@ -13418,6 +13418,9 @@ test_127a() { # bug 15521
        local name count samp unit min max sum sumsq
        local tmpfile=$TMP/$tfile.tmp
 
+       # enable stats header if it is disabled
+       $LCTL set_param enable_stats_header=1
+
        $LFS setstripe -i 0 -c 1 $DIR/$tfile || error "setstripe failed"
        echo "stats before reset"
        stack_trap "rm -f $tmpfile"