Commit 4d20a756 authored by Martin Brandenburg's avatar Martin Brandenburg

orangefs: add readahead count and size to sysfs

Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
parent ed1e1587
...@@ -73,6 +73,24 @@ ...@@ -73,6 +73,24 @@
* Description: * Description:
* Time getattr is valid in milliseconds. * Time getattr is valid in milliseconds.
* *
* What: /sys/fs/orangefs/readahead_count
* Date: Aug 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Readahead cache buffer count.
*
* What: /sys/fs/orangefs/readahead_size
* Date: Aug 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Readahead cache buffer size.
*
* What: /sys/fs/orangefs/readahead_count_size
* Date: Aug 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Readahead cache buffer count and size.
*
* What: /sys/fs/orangefs/acache/... * What: /sys/fs/orangefs/acache/...
* Date: Jun 2015 * Date: Jun 2015
* Contact: Martin Brandenburg <martin@omnibond.com> * Contact: Martin Brandenburg <martin@omnibond.com>
...@@ -836,6 +854,20 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) ...@@ -836,6 +854,20 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
new_op->upcall.req.param.op = new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_PERF_RESET; ORANGEFS_PARAM_REQUEST_OP_PERF_RESET;
else if (!strcmp(orangefs_attr->attr.name,
"readahead_count"))
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
else if (!strcmp(orangefs_attr->attr.name,
"readahead_size"))
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
else if (!strcmp(orangefs_attr->attr.name,
"readahead_count_size"))
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
} else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) { } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) {
acache_attr = (struct acache_orangefs_attribute *)attr; acache_attr = (struct acache_orangefs_attribute *)attr;
...@@ -949,8 +981,17 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) ...@@ -949,8 +981,17 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
out: out:
if (!rc) { if (!rc) {
if (strcmp(kobj_id, PC_KOBJ_ID)) { if (strcmp(kobj_id, PC_KOBJ_ID)) {
if (new_op->upcall.req.param.op ==
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) {
rc = scnprintf(buf, PAGE_SIZE, "%d %d\n",
(int)new_op->downcall.resp.param.u.
value32[0],
(int)new_op->downcall.resp.param.u.
value32[1]);
} else {
rc = scnprintf(buf, PAGE_SIZE, "%d\n", rc = scnprintf(buf, PAGE_SIZE, "%d\n",
(int)new_op->downcall.resp.param.u.value64); (int)new_op->downcall.resp.param.u.value64);
}
} else { } else {
rc = scnprintf( rc = scnprintf(
buf, buf,
...@@ -1077,11 +1118,18 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) ...@@ -1077,11 +1118,18 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)
} }
/* /*
* The value we want to send back to userspace is in buf. * The value we want to send back to userspace is in buf, unless this
* there are two parameters, which is specially handled below.
*/ */
if (strcmp(kobj_id, ORANGEFS_KOBJ_ID) ||
strcmp(((struct orangefs_attribute *)attr)->attr.name,
"readahead_count_size")) {
rc = kstrtoint(buf, 0, &val); rc = kstrtoint(buf, 0, &val);
if (rc) if (rc)
goto out; goto out;
}
new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) {
orangefs_attr = (struct orangefs_attribute *)attr; orangefs_attr = (struct orangefs_attribute *)attr;
...@@ -1112,6 +1160,51 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) ...@@ -1112,6 +1160,51 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)
rc = 0; rc = 0;
goto out; goto out;
} }
} else if (!strcmp(orangefs_attr->attr.name,
"readahead_count")) {
if ((val >= 0)) {
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
} else {
rc = 0;
goto out;
}
} else if (!strcmp(orangefs_attr->attr.name,
"readahead_size")) {
if ((val >= 0)) {
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
} else {
rc = 0;
goto out;
}
} else if (!strcmp(orangefs_attr->attr.name,
"readahead_count_size")) {
int val1, val2;
rc = sscanf(buf, "%d %d", &val1, &val2);
if (rc < 2) {
rc = 0;
goto out;
}
if ((val1 >= 0) && (val2 >= 0)) {
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
} else {
rc = 0;
goto out;
}
new_op->upcall.req.param.u.value32[0] = val1;
new_op->upcall.req.param.u.value32[1] = val2;
goto value_set;
} else if (!strcmp(orangefs_attr->attr.name,
"perf_counter_reset")) {
if ((val > 0)) {
new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
} else {
rc = 0;
goto out;
}
} }
} else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) { } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) {
...@@ -1273,9 +1366,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) ...@@ -1273,9 +1366,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)
goto out; goto out;
} }
new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
new_op->upcall.req.param.u.value64 = val; new_op->upcall.req.param.u.value64 = val;
value_set:
/* /*
* The service_operation will return a errno return code on * The service_operation will return a errno return code on
...@@ -1398,6 +1490,18 @@ static struct orangefs_attribute dcache_timeout_msecs_attribute = ...@@ -1398,6 +1490,18 @@ static struct orangefs_attribute dcache_timeout_msecs_attribute =
static struct orangefs_attribute getattr_timeout_msecs_attribute = static struct orangefs_attribute getattr_timeout_msecs_attribute =
__ATTR(getattr_timeout_msecs, 0664, int_orangefs_show, int_store); __ATTR(getattr_timeout_msecs, 0664, int_orangefs_show, int_store);
static struct orangefs_attribute readahead_count_attribute =
__ATTR(readahead_count, 0664, service_orangefs_show,
service_orangefs_store);
static struct orangefs_attribute readahead_size_attribute =
__ATTR(readahead_size, 0664, service_orangefs_show,
service_orangefs_store);
static struct orangefs_attribute readahead_count_size_attribute =
__ATTR(readahead_count_size, 0664, service_orangefs_show,
service_orangefs_store);
static struct orangefs_attribute perf_counter_reset_attribute = static struct orangefs_attribute perf_counter_reset_attribute =
__ATTR(perf_counter_reset, __ATTR(perf_counter_reset,
0664, 0664,
...@@ -1421,6 +1525,9 @@ static struct attribute *orangefs_default_attrs[] = { ...@@ -1421,6 +1525,9 @@ static struct attribute *orangefs_default_attrs[] = {
&slot_timeout_secs_attribute.attr, &slot_timeout_secs_attribute.attr,
&dcache_timeout_msecs_attribute.attr, &dcache_timeout_msecs_attribute.attr,
&getattr_timeout_msecs_attribute.attr, &getattr_timeout_msecs_attribute.attr,
&readahead_count_attribute.attr,
&readahead_size_attribute.attr,
&readahead_count_size_attribute.attr,
&perf_counter_reset_attribute.attr, &perf_counter_reset_attribute.attr,
&perf_history_size_attribute.attr, &perf_history_size_attribute.attr,
&perf_time_interval_secs_attribute.attr, &perf_time_interval_secs_attribute.attr,
......
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