Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-13857 obdclass: Add white space to output valid YAML.
[fs/lustre-release.git]
/
lustre
/
obdclass
/
lprocfs_jobstats.c
diff --git
a/lustre/obdclass/lprocfs_jobstats.c
b/lustre/obdclass/lprocfs_jobstats.c
index
a341794
..
865881d
100644
(file)
--- a/
lustre/obdclass/lprocfs_jobstats.c
+++ b/
lustre/obdclass/lprocfs_jobstats.c
@@
-30,10
+30,8
@@
#define DEBUG_SUBSYSTEM S_CLASS
#define DEBUG_SUBSYSTEM S_CLASS
-
#include <obd_class.h>
#include <lprocfs_status.h>
#include <obd_class.h>
#include <lprocfs_status.h>
-#include <lustre/lustre_idl.h>
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
@@
-67,8
+65,8
@@
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 */
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 */
- time
_t
js_timestamp; /* seconds of most recent stat*/
+ char js_jobid[LUSTRE_JOBID_SIZE]; /* job name
+ NUL
*/
+ time
64_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 */
};
struct lprocfs_stats *js_stats; /* per-job statistics */
struct obd_job_stats *js_jobstats; /* for accessing ojs_lock */
};
@@
-164,7
+162,7
@@
static int job_cleanup_iter_callback(struct cfs_hash *hs,
struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *data)
{
struct cfs_hash_bd *bd,
struct hlist_node *hnode, void *data)
{
- time
_t oldest_time = *((time
_t *)data);
+ time
64_t oldest_time = *((time64
_t *)data);
struct job_stat *job;
job = hlist_entry(hnode, struct job_stat, js_hash);
struct job_stat *job;
job = hlist_entry(hnode, struct job_stat, js_hash);
@@
-193,8
+191,8
@@
static int job_cleanup_iter_callback(struct cfs_hash *hs,
*/
static void lprocfs_job_cleanup(struct obd_job_stats *stats, int before)
{
*/
static void lprocfs_job_cleanup(struct obd_job_stats *stats, int before)
{
- time
_t now = cfs_time_current_sec
();
- time_t oldest;
+ time
64_t now = ktime_get_real_seconds
();
+ time
64
_t oldest;
if (likely(before >= 0)) {
unsigned int cleanup_interval = stats->ojs_cleanup_interval;
if (likely(before >= 0)) {
unsigned int cleanup_interval = stats->ojs_cleanup_interval;
@@
-234,7
+232,7
@@
static void lprocfs_job_cleanup(struct obd_job_stats *stats, int before)
write_lock(&stats->ojs_lock);
stats->ojs_cleaning = false;
write_lock(&stats->ojs_lock);
stats->ojs_cleaning = false;
- stats->ojs_last_cleanup =
cfs_time_current_sec
();
+ stats->ojs_last_cleanup =
ktime_get_real_seconds
();
write_unlock(&stats->ojs_lock);
}
write_unlock(&stats->ojs_lock);
}
@@
-252,10
+250,10
@@
static struct job_stat *job_alloc(char *jobid, struct obd_job_stats *jobs)
return NULL;
}
return NULL;
}
- jobs->ojs_cntr_init_fn(job->js_stats);
+ jobs->ojs_cntr_init_fn(job->js_stats
, 0
);
- memcpy(job->js_jobid, jobid,
LUSTRE_JOBID_SIZE
);
- job->js_timestamp =
cfs_time_current_sec
();
+ 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);
INIT_LIST_HEAD(&job->js_list);
job->js_jobstats = jobs;
INIT_HLIST_NODE(&job->js_hash);
INIT_LIST_HEAD(&job->js_list);
@@
-315,7
+313,7
@@
int lprocfs_job_stats_log(struct obd_device *obd, char *jobid,
found:
LASSERT(stats == job->js_jobstats);
found:
LASSERT(stats == job->js_jobstats);
- job->js_timestamp =
cfs_time_current_sec
();
+ job->js_timestamp =
ktime_get_real_seconds
();
lprocfs_counter_add(job->js_stats, event, amount);
job_putref(job);
lprocfs_counter_add(job->js_stats, event, amount);
job_putref(job);
@@
-444,7
+442,7
@@
static int lprocfs_jobstats_seq_show(struct seq_file *p, void *v)
}
seq_putc(p, '\n');
}
seq_putc(p, '\n');
- seq_printf(p, " %-16s %ld\n", "snapshot_time:", job->js_timestamp);
+ seq_printf(p, " %-16s %l
l
d\n", "snapshot_time:", job->js_timestamp);
s = job->js_stats;
for (i = 0; i < s->ls_num; i++) {
s = job->js_stats;
for (i = 0; i < s->ls_num; i++) {
@@
-459,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, ", 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);
ret.lc_count ? ret.lc_min : 0,
ret.lc_count ? ret.lc_max : 0,
ret.lc_count ? ret.lc_sum : 0);
@@
-488,10
+485,6
@@
static int lprocfs_jobstats_seq_open(struct inode *inode, struct file *file)
struct seq_file *seq;
int rc;
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;
rc = seq_open(file, &lprocfs_jobstats_seq_sops);
if (rc)
return rc;
@@
-615,7
+608,7
@@
int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
stats->ojs_cntr_num = cntr_num;
stats->ojs_cntr_init_fn = init_fn;
stats->ojs_cleanup_interval = 600; /* 10 mins by default */
stats->ojs_cntr_num = cntr_num;
stats->ojs_cntr_init_fn = init_fn;
stats->ojs_cleanup_interval = 600; /* 10 mins by default */
- stats->ojs_last_cleanup =
cfs_time_current_sec
();
+ stats->ojs_last_cleanup =
ktime_get_real_seconds
();
entry = lprocfs_add_simple(obd->obd_proc_entry, "job_stats", stats,
&lprocfs_jobstats_seq_fops);
entry = lprocfs_add_simple(obd->obd_proc_entry, "job_stats", stats,
&lprocfs_jobstats_seq_fops);
@@
-626,45
+619,38
@@
int lprocfs_job_stats_init(struct obd_device *obd, int cntr_num,
RETURN(0);
}
EXPORT_SYMBOL(lprocfs_job_stats_init);
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;
struct obd_job_stats *stats;
- if (obd == NULL)
- return -ENODEV;
-
stats = &obd->u.obt.obt_jobstats;
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 *buffe
r,
-
size_t count, loff_t *off
)
+ssize_t
job_cleanup_interval_store(struct kobject *kobj,
+
struct attribute *att
r,
+
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;
struct obd_job_stats *stats;
+ unsigned int val;
int rc;
int rc;
- __s64 val;
-
- obd = ((struct seq_file *)file->private_data)->private;
- if (obd == NULL)
- return -ENODEV;
stats = &obd->u.obt.obt_jobstats;
stats = &obd->u.obt.obt_jobstats;
- rc =
lprocfs_str_to_s64(buffer, count
, &val);
+ rc =
kstrtouint(buffer, 0
, &val);
if (rc)
return rc;
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);
return count;
}
stats->ojs_cleanup_interval = val;
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);