[PATCH 36/58] staging/lustre/ptlrpc: move procfs high_priority_ratio file to sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Oleg Drokin <green@xxxxxxxxxxxxxx>

Move ptlrpc service high_priority_ratio entry 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@xxxxxxxxx>
---
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c    | 33 +++++++++++-----------
 drivers/staging/lustre/sysfs-fs-lustre             |  7 +++++
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index ae16450..92d1ce9 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1018,23 +1018,26 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n)
 }
 LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_timeouts);
 
-static int ptlrpc_lprocfs_hp_ratio_seq_show(struct seq_file *m, void *v)
+static ssize_t high_priority_ratio_show(struct kobject *kobj,
+					struct attribute *attr,
+					char *buf)
 {
-	struct ptlrpc_service *svc = m->private;
-	seq_printf(m, "%d", svc->srv_hpreq_ratio);
-	return 0;
+	struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
+						  srv_kobj);
+	return sprintf(buf, "%d\n", svc->srv_hpreq_ratio);
 }
 
-static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file,
-					     const char __user *buffer,
-					     size_t count,
-					     loff_t *off)
+static ssize_t high_priority_ratio_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	rc;
-	int	val;
+	struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
+						  srv_kobj);
+	int rc;
+	unsigned long val;
 
-	rc = lprocfs_write_helper(buffer, count, &val);
+	rc = kstrtoul(buffer, 10, &val);
 	if (rc < 0)
 		return rc;
 
@@ -1047,12 +1050,13 @@ static ssize_t ptlrpc_lprocfs_hp_ratio_seq_write(struct file *file,
 
 	return count;
 }
-LPROC_SEQ_FOPS(ptlrpc_lprocfs_hp_ratio);
+LUSTRE_RW_ATTR(high_priority_ratio);
 
 static struct attribute *ptlrpc_svc_attrs[] = {
 	&lustre_attr_threads_min.attr,
 	&lustre_attr_threads_started.attr,
 	&lustre_attr_threads_max.attr,
+	&lustre_attr_high_priority_ratio.attr,
 	NULL,
 };
 
@@ -1096,9 +1100,6 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry,
 				     struct ptlrpc_service *svc)
 {
 	struct lprocfs_vars lproc_vars[] = {
-		{.name       = "high_priority_ratio",
-		 .fops	     = &ptlrpc_lprocfs_hp_ratio_fops,
-		 .data       = svc},
 		{.name       = "req_buffer_history_len",
 		 .fops	     = &ptlrpc_lprocfs_req_history_len_fops,
 		 .data       = svc},
diff --git a/drivers/staging/lustre/sysfs-fs-lustre b/drivers/staging/lustre/sysfs-fs-lustre
index ed09a11..9817cb3 100644
--- a/drivers/staging/lustre/sysfs-fs-lustre
+++ b/drivers/staging/lustre/sysfs-fs-lustre
@@ -329,3 +329,10 @@ Date:		May 2015
 Contact:	"Oleg Drokin" <oleg.drokin@xxxxxxxxx>
 Description:
 		Shows actual number of ldlm callback threads running.
+
+What:		/sys/fs/lustre/ldlm/services/ldlm_cbd/high_priority_ratio
+Date:		May 2015
+Contact:	"Oleg Drokin" <oleg.drokin@xxxxxxxxx>
+Description:
+		Controls what percentage of ldlm callback threads is dedicated
+		to "high priority" incoming requests.
-- 
2.1.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux