Commit 673a6796 authored by Oleg Drokin's avatar Oleg Drokin Committed by Greg Kroah-Hartman

staging/lustre/ptlrpc: move procfs threads* files to sysfs

Move ptlrpc service threads_min, threads_max and threads_running
entries from procfs to sysfs.
Currently in use only by ldlm callback service only in
/sys/fs/lustre/ldlm/services/ldlm_cbd/
Signed-off-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 328676f8
...@@ -324,23 +324,23 @@ ptlrpc_lprocfs_req_history_max_seq_write(struct file *file, ...@@ -324,23 +324,23 @@ ptlrpc_lprocfs_req_history_max_seq_write(struct file *file,
} }
LPROC_SEQ_FOPS(ptlrpc_lprocfs_req_history_max); LPROC_SEQ_FOPS(ptlrpc_lprocfs_req_history_max);
static int
ptlrpc_lprocfs_threads_min_seq_show(struct seq_file *m, void *n) static ssize_t threads_min_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{ {
struct ptlrpc_service *svc = m->private; struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
seq_printf(m, "%d\n", svc->srv_nthrs_cpt_init * svc->srv_ncpts); return sprintf(buf, "%d\n", svc->srv_nthrs_cpt_init * svc->srv_ncpts);
return 0;
} }
static ssize_t static ssize_t threads_min_store(struct kobject *kobj, struct attribute *attr,
ptlrpc_lprocfs_threads_min_seq_write(struct file *file, const char *buffer, size_t count)
const char __user *buffer,
size_t count, loff_t *off)
{ {
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private; struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
int val; srv_kobj);
int rc = lprocfs_write_helper(buffer, count, &val); unsigned long val;
int rc = kstrtoul(buffer, 10, &val);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -360,12 +360,14 @@ ptlrpc_lprocfs_threads_min_seq_write(struct file *file, ...@@ -360,12 +360,14 @@ ptlrpc_lprocfs_threads_min_seq_write(struct file *file,
return count; return count;
} }
LPROC_SEQ_FOPS(ptlrpc_lprocfs_threads_min); LUSTRE_RW_ATTR(threads_min);
static int static ssize_t threads_started_show(struct kobject *kobj,
ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n) struct attribute *attr,
char *buf)
{ {
struct ptlrpc_service *svc = m->private; struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
struct ptlrpc_service_part *svcpt; struct ptlrpc_service_part *svcpt;
int total = 0; int total = 0;
int i; int i;
...@@ -373,28 +375,26 @@ ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n) ...@@ -373,28 +375,26 @@ ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n)
ptlrpc_service_for_each_part(svcpt, i, svc) ptlrpc_service_for_each_part(svcpt, i, svc)
total += svcpt->scp_nthrs_running; total += svcpt->scp_nthrs_running;
seq_printf(m, "%d\n", total); return sprintf(buf, "%d\n", total);
return 0;
} }
LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_threads_started); LUSTRE_RO_ATTR(threads_started);
static int static ssize_t threads_max_show(struct kobject *kobj, struct attribute *attr,
ptlrpc_lprocfs_threads_max_seq_show(struct seq_file *m, void *n) char *buf)
{ {
struct ptlrpc_service *svc = m->private; struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
seq_printf(m, "%d\n", svc->srv_nthrs_cpt_limit * svc->srv_ncpts); return sprintf(buf, "%d\n", svc->srv_nthrs_cpt_limit * svc->srv_ncpts);
return 0;
} }
static ssize_t static ssize_t threads_max_store(struct kobject *kobj, struct attribute *attr,
ptlrpc_lprocfs_threads_max_seq_write(struct file *file, const char *buffer, size_t count)
const char __user *buffer,
size_t count, loff_t *off)
{ {
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private; struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
int val; srv_kobj);
int rc = lprocfs_write_helper(buffer, count, &val); unsigned long val;
int rc = kstrtoul(buffer, 10, &val);
if (rc < 0) if (rc < 0)
return rc; return rc;
...@@ -414,7 +414,7 @@ ptlrpc_lprocfs_threads_max_seq_write(struct file *file, ...@@ -414,7 +414,7 @@ ptlrpc_lprocfs_threads_max_seq_write(struct file *file,
return count; return count;
} }
LPROC_SEQ_FOPS(ptlrpc_lprocfs_threads_max); LUSTRE_RW_ATTR(threads_max);
/** /**
* \addtogoup nrs * \addtogoup nrs
...@@ -1050,6 +1050,9 @@ static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file, ...@@ -1050,6 +1050,9 @@ static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file,
LPROC_SEQ_FOPS(ptlrpc_lprocfs_hp_ratio); LPROC_SEQ_FOPS(ptlrpc_lprocfs_hp_ratio);
static struct attribute *ptlrpc_svc_attrs[] = { static struct attribute *ptlrpc_svc_attrs[] = {
&lustre_attr_threads_min.attr,
&lustre_attr_threads_started.attr,
&lustre_attr_threads_max.attr,
NULL, NULL,
}; };
...@@ -1102,15 +1105,6 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, ...@@ -1102,15 +1105,6 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
{.name = "req_buffer_history_max", {.name = "req_buffer_history_max",
.fops = &ptlrpc_lprocfs_req_history_max_fops, .fops = &ptlrpc_lprocfs_req_history_max_fops,
.data = svc}, .data = svc},
{.name = "threads_min",
.fops = &ptlrpc_lprocfs_threads_min_fops,
.data = svc},
{.name = "threads_max",
.fops = &ptlrpc_lprocfs_threads_max_fops,
.data = svc},
{.name = "threads_started",
.fops = &ptlrpc_lprocfs_threads_started_fops,
.data = svc},
{.name = "timeouts", {.name = "timeouts",
.fops = &ptlrpc_lprocfs_timeouts_fops, .fops = &ptlrpc_lprocfs_timeouts_fops,
.data = svc}, .data = svc},
......
...@@ -311,3 +311,21 @@ Contact: "Oleg Drokin" <oleg.drokin@intel.com> ...@@ -311,3 +311,21 @@ Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description: Description:
Controls length of time between recalculation of above Controls length of time between recalculation of above
values (in seconds). values (in seconds).
What: /sys/fs/lustre/ldlm/services/ldlm_cbd/threads_min
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Controls minimum number of ldlm callback threads to start.
What: /sys/fs/lustre/ldlm/services/ldlm_cbd/threads_max
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Controls maximum number of ldlm callback threads to start.
What: /sys/fs/lustre/ldlm/services/ldlm_cbd/threads_started
Date: May 2015
Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Shows actual number of ldlm callback threads running.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment