Whamcloud - gitweb
LU-13857 obdclass: Add white space to output valid YAML.
[fs/lustre-release.git] / lustre / obdclass / lprocfs_jobstats.c
index d6d599f..865881d 100644 (file)
@@ -250,7 +250,7 @@ static struct job_stat *job_alloc(char *jobid, struct obd_job_stats *jobs)
                return NULL;
        }
 
-       jobs->ojs_cntr_init_fn(job->js_stats);
+       jobs->ojs_cntr_init_fn(job->js_stats, 0);
 
        memcpy(job->js_jobid, jobid, sizeof(job->js_jobid));
        job->js_timestamp = ktime_get_real_seconds();
@@ -457,8 +457,7 @@ static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v)
                        seq_printf(p, ", unit: %5s", cntr_header->lc_units);
 
                if (cntr_header->lc_config & LPROCFS_CNTR_AVGMINMAX) {
-                       seq_printf(p, ", min:%8llu, max:%8llu,"
-                                  " sum:%16llu",
+                       seq_printf(p, ", min: %8llu, max: %8llu, sum: %16llu",
                                   ret.lc_count ? ret.lc_min : 0,
                                   ret.lc_count ? ret.lc_max : 0,
                                   ret.lc_count ? ret.lc_sum : 0);
@@ -486,10 +485,6 @@ static int lprocfs_jobstats_seq_open(struct inode *inode, struct file *file)
        struct seq_file *seq;
        int rc;
 
-       rc = LPROCFS_ENTRY_CHECK(inode);
-       if (rc < 0)
-               return rc;
-
        rc = seq_open(file, &lprocfs_jobstats_seq_sops);
        if (rc)
                return rc;
@@ -624,37 +619,33 @@ int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
        RETURN(0);
 }
 EXPORT_SYMBOL(lprocfs_job_stats_init);
+#endif /* CONFIG_PROC_FS*/
 
-int lprocfs_job_interval_seq_show(struct seq_file *m, void *data)
+ssize_t job_cleanup_interval_show(struct kobject *kobj, struct attribute *attr,
+                                 char *buf)
 {
-       struct obd_device *obd = m->private;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kset.kobj);
        struct obd_job_stats *stats;
 
-       if (obd == NULL)
-               return -ENODEV;
-
        stats = &obd->u.obt.obt_jobstats;
-       seq_printf(m, "%d\n", stats->ojs_cleanup_interval);
-       return 0;
+       return scnprintf(buf, PAGE_SIZE, "%d\n", stats->ojs_cleanup_interval);
 }
-EXPORT_SYMBOL(lprocfs_job_interval_seq_show);
+EXPORT_SYMBOL(job_cleanup_interval_show);
 
-ssize_t
-lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
-                               size_t count, loff_t *off)
+ssize_t job_cleanup_interval_store(struct kobject *kobj,
+                                  struct attribute *attr,
+                                  const char *buffer, size_t count)
 {
-       struct obd_device *obd;
+       struct obd_device *obd = container_of(kobj, struct obd_device,
+                                             obd_kset.kobj);
        struct obd_job_stats *stats;
        unsigned int val;
        int rc;
 
-       obd = ((struct seq_file *)file->private_data)->private;
-       if (obd == NULL)
-               return -ENODEV;
-
        stats = &obd->u.obt.obt_jobstats;
 
-       rc = kstrtouint_from_user(buffer, count, 0, &val);
+       rc = kstrtouint(buffer, 0, &val);
        if (rc)
                return rc;
 
@@ -662,5 +653,4 @@ lprocfs_job_interval_seq_write(struct file *file, const char __user *buffer,
        lprocfs_job_cleanup(stats, stats->ojs_cleanup_interval);
        return count;
 }
-EXPORT_SYMBOL(lprocfs_job_interval_seq_write);
-#endif /* CONFIG_PROC_FS*/
+EXPORT_SYMBOL(job_cleanup_interval_store);