Whamcloud - gitweb
LU-7187 jobstats: confine the output of jobid to single line 93/16593/3
authorNiu Yawei <yawei.niu@intel.com>
Tue, 22 Sep 2015 02:44:11 +0000 (22:44 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 2 Oct 2015 04:14:06 +0000 (04:14 +0000)
Repalce the non-printable characters into '?' when display the
jobid via proc file, so that output of jobid will be confined
to a single line and not break the YAML indention.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: Ic4e0e6196a13b46f20d96ccce7705c62674f2440
Reviewed-on: http://review.whamcloud.com/16593
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/lprocfs_jobstats.c

index 6dbf3da..cc86ca2 100644 (file)
@@ -433,7 +433,17 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v)
                return 0;
        }
 
-       seq_printf(p, "- %-16s %s\n", "job_id:", job->js_jobid);
+       /* Replace the non-printable character in jobid with '?', so
+        * that the output of jobid will be confined in single line. */
+       seq_printf(p, "- %-16s ", "job_id:");
+       for (i = 0; i < strlen(job->js_jobid); i++) {
+               if (isprint(job->js_jobid[i]) != 0)
+                       seq_putc(p, job->js_jobid[i]);
+               else
+                       seq_putc(p, '?');
+       }
+       seq_putc(p, '\n');
+
        seq_printf(p, "  %-16s %ld\n", "snapshot_time:", job->js_timestamp);
 
        s = job->js_stats;