Whamcloud - gitweb
LU-10698 obdclass: allow specifying complex jobids
[fs/lustre-release.git] / lustre / obdclass / lprocfs_jobstats.c
index dc1f6b2..d6d599f 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_CLASS
 
-
 #include <obd_class.h>
 #include <lprocfs_status.h>
-#include <lustre/lustre_idl.h>
 
 #ifdef CONFIG_PROC_FS
 
@@ -67,7 +65,7 @@ struct job_stat {
        struct hlist_node       js_hash;        /* hash struct for this jobid */
        struct list_head        js_list;        /* on ojs_list, with ojs_lock */
        atomic_t                js_refcount;    /* num users of this struct */
-       char                    js_jobid[LUSTRE_JOBID_SIZE]; /* job name */
+       char                    js_jobid[LUSTRE_JOBID_SIZE]; /* job name + NUL*/
        time64_t                js_timestamp;   /* seconds of most recent stat*/
        struct lprocfs_stats    *js_stats;      /* per-job statistics */
        struct obd_job_stats    *js_jobstats;   /* for accessing ojs_lock */
@@ -254,7 +252,7 @@ static struct job_stat *job_alloc(char *jobid, struct obd_job_stats *jobs)
 
        jobs->ojs_cntr_init_fn(job->js_stats);
 
-       memcpy(job->js_jobid, jobid, LUSTRE_JOBID_SIZE);
+       memcpy(job->js_jobid, jobid, sizeof(job->js_jobid));
        job->js_timestamp = ktime_get_real_seconds();
        job->js_jobstats = jobs;
        INIT_HLIST_NODE(&job->js_hash);
@@ -647,8 +645,8 @@ lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
 {
        struct obd_device *obd;
        struct obd_job_stats *stats;
+       unsigned int val;
        int rc;
-       __s64 val;
 
        obd = ((struct seq_file *)file->private_data)->private;
        if (obd == NULL)
@@ -656,11 +654,9 @@ lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
 
        stats = &obd->u.obt.obt_jobstats;
 
-       rc = lprocfs_str_to_s64(buffer, count, &val);
+       rc = kstrtouint_from_user(buffer, count, 0, &val);
        if (rc)
                return rc;
-       if (val < 0 || val > UINT_MAX)
-               return -ERANGE;
 
        stats->ojs_cleanup_interval = val;
        lprocfs_job_cleanup(stats, stats->ojs_cleanup_interval);