aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/orangefs/orangefs-sysfs.c123
1 files changed, 115 insertions, 8 deletions
diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c
index 044ca6506775..2fe9a3a2117b 100644
--- a/fs/orangefs/orangefs-sysfs.c
+++ b/fs/orangefs/orangefs-sysfs.c
@@ -73,6 +73,24 @@
73 * Description: 73 * Description:
74 * Time getattr is valid in milliseconds. 74 * Time getattr is valid in milliseconds.
75 * 75 *
76 * What: /sys/fs/orangefs/readahead_count
77 * Date: Aug 2016
78 * Contact: Martin Brandenburg <martin@omnibond.com>
79 * Description:
80 * Readahead cache buffer count.
81 *
82 * What: /sys/fs/orangefs/readahead_size
83 * Date: Aug 2016
84 * Contact: Martin Brandenburg <martin@omnibond.com>
85 * Description:
86 * Readahead cache buffer size.
87 *
88 * What: /sys/fs/orangefs/readahead_count_size
89 * Date: Aug 2016
90 * Contact: Martin Brandenburg <martin@omnibond.com>
91 * Description:
92 * Readahead cache buffer count and size.
93 *
76 * What: /sys/fs/orangefs/acache/... 94 * What: /sys/fs/orangefs/acache/...
77 * Date: Jun 2015 95 * Date: Jun 2015
78 * Contact: Martin Brandenburg <martin@omnibond.com> 96 * Contact: Martin Brandenburg <martin@omnibond.com>
@@ -836,6 +854,20 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
836 new_op->upcall.req.param.op = 854 new_op->upcall.req.param.op =
837 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET; 855 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET;
838 856
857 else if (!strcmp(orangefs_attr->attr.name,
858 "readahead_count"))
859 new_op->upcall.req.param.op =
860 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
861
862 else if (!strcmp(orangefs_attr->attr.name,
863 "readahead_size"))
864 new_op->upcall.req.param.op =
865 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
866
867 else if (!strcmp(orangefs_attr->attr.name,
868 "readahead_count_size"))
869 new_op->upcall.req.param.op =
870 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
839 } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) { 871 } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) {
840 acache_attr = (struct acache_orangefs_attribute *)attr; 872 acache_attr = (struct acache_orangefs_attribute *)attr;
841 873
@@ -949,8 +981,17 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
949out: 981out:
950 if (!rc) { 982 if (!rc) {
951 if (strcmp(kobj_id, PC_KOBJ_ID)) { 983 if (strcmp(kobj_id, PC_KOBJ_ID)) {
952 rc = scnprintf(buf, PAGE_SIZE, "%d\n", 984 if (new_op->upcall.req.param.op ==
953 (int)new_op->downcall.resp.param.u.value64); 985 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) {
986 rc = scnprintf(buf, PAGE_SIZE, "%d %d\n",
987 (int)new_op->downcall.resp.param.u.
988 value32[0],
989 (int)new_op->downcall.resp.param.u.
990 value32[1]);
991 } else {
992 rc = scnprintf(buf, PAGE_SIZE, "%d\n",
993 (int)new_op->downcall.resp.param.u.value64);
994 }
954 } else { 995 } else {
955 rc = scnprintf( 996 rc = scnprintf(
956 buf, 997 buf,
@@ -1077,11 +1118,18 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)
1077 } 1118 }
1078 1119
1079 /* 1120 /*
1080 * The value we want to send back to userspace is in buf. 1121 * The value we want to send back to userspace is in buf, unless this
1122 * there are two parameters, which is specially handled below.
1081 */ 1123 */
1082 rc = kstrtoint(buf, 0, &val); 1124 if (strcmp(kobj_id, ORANGEFS_KOBJ_ID) ||
1083 if (rc) 1125 strcmp(((struct orangefs_attribute *)attr)->attr.name,
1084 goto out; 1126 "readahead_count_size")) {
1127 rc = kstrtoint(buf, 0, &val);
1128 if (rc)
1129 goto out;
1130 }
1131
1132 new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
1085 1133
1086 if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { 1134 if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) {
1087 orangefs_attr = (struct orangefs_attribute *)attr; 1135 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 rc = 0; 1160 rc = 0;
1113 goto out; 1161 goto out;
1114 } 1162 }
1163 } else if (!strcmp(orangefs_attr->attr.name,
1164 "readahead_count")) {
1165 if ((val >= 0)) {
1166 new_op->upcall.req.param.op =
1167 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
1168 } else {
1169 rc = 0;
1170 goto out;
1171 }
1172 } else if (!strcmp(orangefs_attr->attr.name,
1173 "readahead_size")) {
1174 if ((val >= 0)) {
1175 new_op->upcall.req.param.op =
1176 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
1177 } else {
1178 rc = 0;
1179 goto out;
1180 }
1181 } else if (!strcmp(orangefs_attr->attr.name,
1182 "readahead_count_size")) {
1183 int val1, val2;
1184 rc = sscanf(buf, "%d %d", &val1, &val2);
1185 if (rc < 2) {
1186 rc = 0;
1187 goto out;
1188 }
1189 if ((val1 >= 0) && (val2 >= 0)) {
1190 new_op->upcall.req.param.op =
1191 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
1192 } else {
1193 rc = 0;
1194 goto out;
1195 }
1196 new_op->upcall.req.param.u.value32[0] = val1;
1197 new_op->upcall.req.param.u.value32[1] = val2;
1198 goto value_set;
1199 } else if (!strcmp(orangefs_attr->attr.name,
1200 "perf_counter_reset")) {
1201 if ((val > 0)) {
1202 new_op->upcall.req.param.op =
1203 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
1204 } else {
1205 rc = 0;
1206 goto out;
1207 }
1115 } 1208 }
1116 1209
1117 } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) { 1210 } 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 goto out; 1366 goto out;
1274 } 1367 }
1275 1368
1276 new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
1277
1278 new_op->upcall.req.param.u.value64 = val; 1369 new_op->upcall.req.param.u.value64 = val;
1370value_set:
1279 1371
1280 /* 1372 /*
1281 * The service_operation will return a errno return code on 1373 * The service_operation will return a errno return code on
@@ -1398,6 +1490,18 @@ static struct orangefs_attribute dcache_timeout_msecs_attribute =
1398static struct orangefs_attribute getattr_timeout_msecs_attribute = 1490static struct orangefs_attribute getattr_timeout_msecs_attribute =
1399 __ATTR(getattr_timeout_msecs, 0664, int_orangefs_show, int_store); 1491 __ATTR(getattr_timeout_msecs, 0664, int_orangefs_show, int_store);
1400 1492
1493static struct orangefs_attribute readahead_count_attribute =
1494 __ATTR(readahead_count, 0664, service_orangefs_show,
1495 service_orangefs_store);
1496
1497static struct orangefs_attribute readahead_size_attribute =
1498 __ATTR(readahead_size, 0664, service_orangefs_show,
1499 service_orangefs_store);
1500
1501static struct orangefs_attribute readahead_count_size_attribute =
1502 __ATTR(readahead_count_size, 0664, service_orangefs_show,
1503 service_orangefs_store);
1504
1401static struct orangefs_attribute perf_counter_reset_attribute = 1505static struct orangefs_attribute perf_counter_reset_attribute =
1402 __ATTR(perf_counter_reset, 1506 __ATTR(perf_counter_reset,
1403 0664, 1507 0664,
@@ -1421,6 +1525,9 @@ static struct attribute *orangefs_default_attrs[] = {
1421 &slot_timeout_secs_attribute.attr, 1525 &slot_timeout_secs_attribute.attr,
1422 &dcache_timeout_msecs_attribute.attr, 1526 &dcache_timeout_msecs_attribute.attr,
1423 &getattr_timeout_msecs_attribute.attr, 1527 &getattr_timeout_msecs_attribute.attr,
1528 &readahead_count_attribute.attr,
1529 &readahead_size_attribute.attr,
1530 &readahead_count_size_attribute.attr,
1424 &perf_counter_reset_attribute.attr, 1531 &perf_counter_reset_attribute.attr,
1425 &perf_history_size_attribute.attr, 1532 &perf_history_size_attribute.attr,
1426 &perf_time_interval_secs_attribute.attr, 1533 &perf_time_interval_secs_attribute.attr,