From: Andreas Dilger Date: Fri, 1 Sep 2023 00:08:30 +0000 (-0600) Subject: LU-17005 obdclass: only print seconds for job_stats X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b484128db04d310aeeffbaebbe47b930f734d891;p=fs%2Flustre-release.git LU-17005 obdclass: only print seconds for job_stats Only print the seconds field for the job_stats snapshot_time: field. Otherwise the addition of the usec and "secs.usec" units field can break the output parsing. There is no way to print only the seconds in lprocfs_stats_header(), since all of the other snapshot_time: fields previously printed the microseconds field also, so use seq_printf() with the old format. Test-Parameters: trivial Fixes: 5efb892396e3 ("LU-11407 obdclass: add start time to stats files") Signed-off-by: Andreas Dilger Change-Id: I1bda709e3bc4231d42f6a98e7487f0b11445f056 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52212 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Feng Lei Reviewed-by: Nathaniel Clark --- diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c index 3c078fd..8ca2e80 100644 --- a/lustre/obdclass/lprocfs_jobstats.c +++ b/lustre/obdclass/lprocfs_jobstats.c @@ -517,8 +517,19 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v) seq_printf(p, "- %-16s %s%*s%s\n", "job_id:", quote, joblen, escaped, quote); - lprocfs_stats_header(p, job->js_time_latest, job->js_stats->ls_init, - 16, ":", true, " "); + if (obd_enable_stats_header) { + lprocfs_stats_header(p, job->js_time_latest, + job->js_stats->ls_init, + 16, ":", true, " "); + } else { + struct timespec64 ts = ktime_to_timespec64(job->js_time_latest); + + /* print directly for compat, no way to skip msecs field */ + seq_printf(p, " %-16s %lld\n", "snapshot_time:", + (long long)ts.tv_sec); + } + + s = job->js_stats; for (i = 0; i < s->ls_num; i++) {