1
0
Fork 0

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: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
hifive-unleashed-5.1
Oleg Drokin 2015-05-21 15:32:09 -04:00 committed by Greg Kroah-Hartman
parent 328676f823
commit 673a6796f2
2 changed files with 56 additions and 44 deletions

View File

@ -324,23 +324,23 @@ ptlrpc_lprocfs_req_history_max_seq_write(struct file *file,
}
LPROC_SEQ_FOPS(ptlrpc_lprocfs_req_history_max);
static int
ptlrpc_lprocfs_threads_min_seq_show(struct seq_file *m, void *n)
{
struct ptlrpc_service *svc = m->private;
seq_printf(m, "%d\n", svc->srv_nthrs_cpt_init * svc->srv_ncpts);
return 0;
static ssize_t threads_min_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
return sprintf(buf, "%d\n", svc->srv_nthrs_cpt_init * svc->srv_ncpts);
}
static ssize_t
ptlrpc_lprocfs_threads_min_seq_write(struct file *file,
const char __user *buffer,
size_t count, loff_t *off)
static ssize_t threads_min_store(struct kobject *kobj, struct attribute *attr,
const char *buffer, size_t count)
{
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
int val;
int rc = lprocfs_write_helper(buffer, count, &val);
struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
unsigned long val;
int rc = kstrtoul(buffer, 10, &val);
if (rc < 0)
return rc;
@ -360,41 +360,41 @@ ptlrpc_lprocfs_threads_min_seq_write(struct file *file,
return count;
}
LPROC_SEQ_FOPS(ptlrpc_lprocfs_threads_min);
LUSTRE_RW_ATTR(threads_min);
static int
ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n)
static ssize_t threads_started_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);
struct ptlrpc_service_part *svcpt;
int total = 0;
int i;
int total = 0;
int i;
ptlrpc_service_for_each_part(svcpt, i, svc)
total += svcpt->scp_nthrs_running;
seq_printf(m, "%d\n", total);
return 0;
return sprintf(buf, "%d\n", total);
}
LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_threads_started);
LUSTRE_RO_ATTR(threads_started);
static int
ptlrpc_lprocfs_threads_max_seq_show(struct seq_file *m, void *n)
static ssize_t threads_max_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_limit * svc->srv_ncpts);
return 0;
return sprintf(buf, "%d\n", svc->srv_nthrs_cpt_limit * svc->srv_ncpts);
}
static ssize_t
ptlrpc_lprocfs_threads_max_seq_write(struct file *file,
const char __user *buffer,
size_t count, loff_t *off)
static ssize_t threads_max_store(struct kobject *kobj, struct attribute *attr,
const char *buffer, size_t count)
{
struct ptlrpc_service *svc = ((struct seq_file *)file->private_data)->private;
int val;
int rc = lprocfs_write_helper(buffer, count, &val);
struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
unsigned long val;
int rc = kstrtoul(buffer, 10, &val);
if (rc < 0)
return rc;
@ -414,7 +414,7 @@ ptlrpc_lprocfs_threads_max_seq_write(struct file *file,
return count;
}
LPROC_SEQ_FOPS(ptlrpc_lprocfs_threads_max);
LUSTRE_RW_ATTR(threads_max);
/**
* \addtogoup nrs
@ -1050,6 +1050,9 @@ static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file,
LPROC_SEQ_FOPS(ptlrpc_lprocfs_hp_ratio);
static struct attribute *ptlrpc_svc_attrs[] = {
&lustre_attr_threads_min.attr,
&lustre_attr_threads_started.attr,
&lustre_attr_threads_max.attr,
NULL,
};
@ -1102,15 +1105,6 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
{.name = "req_buffer_history_max",
.fops = &ptlrpc_lprocfs_req_history_max_fops,
.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",
.fops = &ptlrpc_lprocfs_timeouts_fops,
.data = svc},

View File

@ -311,3 +311,21 @@ Contact: "Oleg Drokin" <oleg.drokin@intel.com>
Description:
Controls length of time between recalculation of above
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.