2 * Documentation/ABI/stable/orangefs-sysfs:
4 * What: /sys/fs/orangefs/perf_counter_reset
6 * Contact: Mike Marshall <hubcap@omnibond.com>
8 * echo a 0 or a 1 into perf_counter_reset to
9 * reset all the counters in
10 * /sys/fs/orangefs/perf_counters
11 * except ones with PINT_PERF_PRESERVE set.
14 * What: /sys/fs/orangefs/perf_counters/...
16 * Contact: Mike Marshall <hubcap@omnibond.com>
18 * Counters and settings for various caches.
22 * What: /sys/fs/orangefs/perf_time_interval_secs
24 * Contact: Mike Marshall <hubcap@omnibond.com>
26 * Length of perf counter intervals in
30 * What: /sys/fs/orangefs/perf_history_size
32 * Contact: Mike Marshall <hubcap@omnibond.com>
34 * The perf_counters cache statistics have N, or
35 * perf_history_size, samples. The default is
38 * Every perf_time_interval_secs the (first)
41 * If N is greater than one, the "current" set
42 * of samples is reset, and the samples from the
43 * other N-1 intervals remain available.
46 * What: /sys/fs/orangefs/op_timeout_secs
48 * Contact: Mike Marshall <hubcap@omnibond.com>
50 * Service operation timeout in seconds.
53 * What: /sys/fs/orangefs/slot_timeout_secs
55 * Contact: Mike Marshall <hubcap@omnibond.com>
57 * "Slot" timeout in seconds. A "slot"
58 * is an indexed buffer in the shared
59 * memory segment used for communication
60 * between the kernel module and userspace.
61 * Slots are requested and waited for,
62 * the wait times out after slot_timeout_secs.
64 * What: /sys/fs/orangefs/dcache_timeout_msecs
66 * Contact: Martin Brandenburg <martin@omnibond.com>
68 * Time lookup is valid in milliseconds.
70 * What: /sys/fs/orangefs/getattr_timeout_msecs
72 * Contact: Martin Brandenburg <martin@omnibond.com>
74 * Time getattr is valid in milliseconds.
76 * What: /sys/fs/orangefs/readahead_count
78 * Contact: Martin Brandenburg <martin@omnibond.com>
80 * Readahead cache buffer count.
82 * What: /sys/fs/orangefs/readahead_size
84 * Contact: Martin Brandenburg <martin@omnibond.com>
86 * Readahead cache buffer size.
88 * What: /sys/fs/orangefs/readahead_count_size
90 * Contact: Martin Brandenburg <martin@omnibond.com>
92 * Readahead cache buffer count and size.
94 * What: /sys/fs/orangefs/acache/...
96 * Contact: Martin Brandenburg <martin@omnibond.com>
98 * Attribute cache configurable settings.
101 * What: /sys/fs/orangefs/ncache/...
103 * Contact: Mike Marshall <hubcap@omnibond.com>
105 * Name cache configurable settings.
108 * What: /sys/fs/orangefs/capcache/...
110 * Contact: Mike Marshall <hubcap@omnibond.com>
112 * Capability cache configurable settings.
115 * What: /sys/fs/orangefs/ccache/...
117 * Contact: Mike Marshall <hubcap@omnibond.com>
119 * Credential cache configurable settings.
123 #include <linux/fs.h>
124 #include <linux/kobject.h>
125 #include <linux/string.h>
126 #include <linux/sysfs.h>
127 #include <linux/module.h>
128 #include <linux/init.h>
130 #include "protocol.h"
131 #include "orangefs-kernel.h"
132 #include "orangefs-sysfs.h"
134 #define ORANGEFS_KOBJ_ID "orangefs"
135 #define ACACHE_KOBJ_ID "acache"
136 #define CAPCACHE_KOBJ_ID "capcache"
137 #define CCACHE_KOBJ_ID "ccache"
138 #define NCACHE_KOBJ_ID "ncache"
139 #define PC_KOBJ_ID "pc"
140 #define STATS_KOBJ_ID "stats"
143 * Every item calls orangefs_attr_show and orangefs_attr_store through
144 * orangefs_sysfs_ops. They look at the orangefs_attributes further below to
145 * call one of sysfs_int_show, sysfs_int_store, sysfs_service_op_show, or
146 * sysfs_service_op_store.
149 struct orangefs_attribute
{
150 struct attribute attr
;
151 ssize_t (*show
)(struct kobject
*kobj
,
152 struct orangefs_attribute
*attr
,
154 ssize_t (*store
)(struct kobject
*kobj
,
155 struct orangefs_attribute
*attr
,
160 static ssize_t
orangefs_attr_show(struct kobject
*kobj
,
161 struct attribute
*attr
,
164 struct orangefs_attribute
*attribute
;
166 attribute
= container_of(attr
, struct orangefs_attribute
, attr
);
167 if (!attribute
->show
)
169 return attribute
->show(kobj
, attribute
, buf
);
172 static ssize_t
orangefs_attr_store(struct kobject
*kobj
,
173 struct attribute
*attr
,
177 struct orangefs_attribute
*attribute
;
179 if (!strcmp(kobj
->name
, PC_KOBJ_ID
) ||
180 !strcmp(kobj
->name
, STATS_KOBJ_ID
))
183 attribute
= container_of(attr
, struct orangefs_attribute
, attr
);
184 if (!attribute
->store
)
186 return attribute
->store(kobj
, attribute
, buf
, len
);
189 static const struct sysfs_ops orangefs_sysfs_ops
= {
190 .show
= orangefs_attr_show
,
191 .store
= orangefs_attr_store
,
194 static ssize_t
sysfs_int_show(struct kobject
*kobj
,
195 struct orangefs_attribute
*attr
, char *buf
)
199 gossip_debug(GOSSIP_SYSFS_DEBUG
, "sysfs_int_show: id:%s:\n",
202 if (!strcmp(kobj
->name
, ORANGEFS_KOBJ_ID
)) {
203 if (!strcmp(attr
->attr
.name
, "op_timeout_secs")) {
209 } else if (!strcmp(attr
->attr
.name
,
210 "slot_timeout_secs")) {
216 } else if (!strcmp(attr
->attr
.name
,
217 "dcache_timeout_msecs")) {
221 orangefs_dcache_timeout_msecs
);
223 } else if (!strcmp(attr
->attr
.name
,
224 "getattr_timeout_msecs")) {
228 orangefs_getattr_timeout_msecs
);
234 } else if (!strcmp(kobj
->name
, STATS_KOBJ_ID
)) {
235 if (!strcmp(attr
->attr
.name
, "reads")) {
239 orangefs_stats
.reads
);
241 } else if (!strcmp(attr
->attr
.name
, "writes")) {
245 orangefs_stats
.writes
);
257 static ssize_t
sysfs_int_store(struct kobject
*kobj
,
258 struct orangefs_attribute
*attr
, const char *buf
, size_t count
)
262 gossip_debug(GOSSIP_SYSFS_DEBUG
,
263 "sysfs_int_store: start attr->attr.name:%s: buf:%s:\n",
264 attr
->attr
.name
, buf
);
266 if (!strcmp(attr
->attr
.name
, "op_timeout_secs")) {
267 rc
= kstrtoint(buf
, 0, &op_timeout_secs
);
269 } else if (!strcmp(attr
->attr
.name
, "slot_timeout_secs")) {
270 rc
= kstrtoint(buf
, 0, &slot_timeout_secs
);
272 } else if (!strcmp(attr
->attr
.name
, "dcache_timeout_msecs")) {
273 rc
= kstrtoint(buf
, 0, &orangefs_dcache_timeout_msecs
);
275 } else if (!strcmp(attr
->attr
.name
, "getattr_timeout_msecs")) {
276 rc
= kstrtoint(buf
, 0, &orangefs_getattr_timeout_msecs
);
292 * obtain attribute values from userspace with a service operation.
294 static ssize_t
sysfs_service_op_show(struct kobject
*kobj
,
295 struct orangefs_attribute
*attr
, char *buf
)
297 struct orangefs_kernel_op_s
*new_op
= NULL
;
299 char *ser_op_type
= NULL
;
302 gossip_debug(GOSSIP_SYSFS_DEBUG
,
303 "sysfs_service_op_show: id:%s:\n",
306 if (strcmp(kobj
->name
, PC_KOBJ_ID
))
307 op_alloc_type
= ORANGEFS_VFS_OP_PARAM
;
309 op_alloc_type
= ORANGEFS_VFS_OP_PERF_COUNT
;
311 new_op
= op_alloc(op_alloc_type
);
315 /* Can't do a service_operation if the client is not running... */
316 rc
= is_daemon_in_service();
318 pr_info("%s: Client not running :%d:\n",
320 is_daemon_in_service());
324 if (strcmp(kobj
->name
, PC_KOBJ_ID
))
325 new_op
->upcall
.req
.param
.type
= ORANGEFS_PARAM_REQUEST_GET
;
327 if (!strcmp(kobj
->name
, ORANGEFS_KOBJ_ID
)) {
328 /* Drop unsupported requests first. */
329 if (!(orangefs_features
& ORANGEFS_FEATURE_READAHEAD
) &&
330 (!strcmp(attr
->attr
.name
, "readahead_count") ||
331 !strcmp(attr
->attr
.name
, "readahead_size") ||
332 !strcmp(attr
->attr
.name
, "readahead_count_size"))) {
337 if (!strcmp(attr
->attr
.name
, "perf_history_size"))
338 new_op
->upcall
.req
.param
.op
=
339 ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE
;
340 else if (!strcmp(attr
->attr
.name
,
341 "perf_time_interval_secs"))
342 new_op
->upcall
.req
.param
.op
=
343 ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS
;
344 else if (!strcmp(attr
->attr
.name
,
345 "perf_counter_reset"))
346 new_op
->upcall
.req
.param
.op
=
347 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET
;
349 else if (!strcmp(attr
->attr
.name
,
351 new_op
->upcall
.req
.param
.op
=
352 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT
;
354 else if (!strcmp(attr
->attr
.name
,
356 new_op
->upcall
.req
.param
.op
=
357 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE
;
359 else if (!strcmp(attr
->attr
.name
,
360 "readahead_count_size"))
361 new_op
->upcall
.req
.param
.op
=
362 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE
;
363 } else if (!strcmp(kobj
->name
, ACACHE_KOBJ_ID
)) {
364 if (!strcmp(attr
->attr
.name
, "timeout_msecs"))
365 new_op
->upcall
.req
.param
.op
=
366 ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS
;
368 if (!strcmp(attr
->attr
.name
, "hard_limit"))
369 new_op
->upcall
.req
.param
.op
=
370 ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT
;
372 if (!strcmp(attr
->attr
.name
, "soft_limit"))
373 new_op
->upcall
.req
.param
.op
=
374 ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT
;
376 if (!strcmp(attr
->attr
.name
, "reclaim_percentage"))
377 new_op
->upcall
.req
.param
.op
=
378 ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE
;
380 } else if (!strcmp(kobj
->name
, CAPCACHE_KOBJ_ID
)) {
381 if (!strcmp(attr
->attr
.name
, "timeout_secs"))
382 new_op
->upcall
.req
.param
.op
=
383 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS
;
385 if (!strcmp(attr
->attr
.name
, "hard_limit"))
386 new_op
->upcall
.req
.param
.op
=
387 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT
;
389 if (!strcmp(attr
->attr
.name
, "soft_limit"))
390 new_op
->upcall
.req
.param
.op
=
391 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT
;
393 if (!strcmp(attr
->attr
.name
, "reclaim_percentage"))
394 new_op
->upcall
.req
.param
.op
=
395 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE
;
397 } else if (!strcmp(kobj
->name
, CCACHE_KOBJ_ID
)) {
398 if (!strcmp(attr
->attr
.name
, "timeout_secs"))
399 new_op
->upcall
.req
.param
.op
=
400 ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS
;
402 if (!strcmp(attr
->attr
.name
, "hard_limit"))
403 new_op
->upcall
.req
.param
.op
=
404 ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT
;
406 if (!strcmp(attr
->attr
.name
, "soft_limit"))
407 new_op
->upcall
.req
.param
.op
=
408 ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT
;
410 if (!strcmp(attr
->attr
.name
, "reclaim_percentage"))
411 new_op
->upcall
.req
.param
.op
=
412 ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE
;
414 } else if (!strcmp(kobj
->name
, NCACHE_KOBJ_ID
)) {
415 if (!strcmp(attr
->attr
.name
, "timeout_msecs"))
416 new_op
->upcall
.req
.param
.op
=
417 ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS
;
419 if (!strcmp(attr
->attr
.name
, "hard_limit"))
420 new_op
->upcall
.req
.param
.op
=
421 ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT
;
423 if (!strcmp(attr
->attr
.name
, "soft_limit"))
424 new_op
->upcall
.req
.param
.op
=
425 ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT
;
427 if (!strcmp(attr
->attr
.name
, "reclaim_percentage"))
428 new_op
->upcall
.req
.param
.op
=
429 ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE
;
431 } else if (!strcmp(kobj
->name
, PC_KOBJ_ID
)) {
432 if (!strcmp(attr
->attr
.name
, ACACHE_KOBJ_ID
))
433 new_op
->upcall
.req
.perf_count
.type
=
434 ORANGEFS_PERF_COUNT_REQUEST_ACACHE
;
436 if (!strcmp(attr
->attr
.name
, CAPCACHE_KOBJ_ID
))
437 new_op
->upcall
.req
.perf_count
.type
=
438 ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE
;
440 if (!strcmp(attr
->attr
.name
, NCACHE_KOBJ_ID
))
441 new_op
->upcall
.req
.perf_count
.type
=
442 ORANGEFS_PERF_COUNT_REQUEST_NCACHE
;
445 gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n",
452 if (strcmp(kobj
->name
, PC_KOBJ_ID
))
453 ser_op_type
= "orangefs_param";
455 ser_op_type
= "orangefs_perf_count";
458 * The service_operation will return an errno return code on
459 * error, and zero on success.
461 rc
= service_operation(new_op
, ser_op_type
, ORANGEFS_OP_INTERRUPTIBLE
);
465 if (strcmp(kobj
->name
, PC_KOBJ_ID
)) {
466 if (new_op
->upcall
.req
.param
.op
==
467 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE
) {
468 rc
= scnprintf(buf
, PAGE_SIZE
, "%d %d\n",
469 (int)new_op
->downcall
.resp
.param
.u
.
471 (int)new_op
->downcall
.resp
.param
.u
.
474 rc
= scnprintf(buf
, PAGE_SIZE
, "%d\n",
475 (int)new_op
->downcall
.resp
.param
.u
.value64
);
482 new_op
->downcall
.resp
.perf_count
.buffer
);
493 * pass attribute values back to userspace with a service operation.
495 * We have to do a memory allocation, an sscanf and a service operation.
496 * And we have to evaluate what the user entered, to make sure the
497 * value is within the range supported by the attribute. So, there's
498 * a lot of return code checking and mapping going on here.
500 * We want to return 1 if we think everything went OK, and
503 static ssize_t
sysfs_service_op_store(struct kobject
*kobj
,
504 struct orangefs_attribute
*attr
, const char *buf
, size_t count
)
506 struct orangefs_kernel_op_s
*new_op
= NULL
;
510 gossip_debug(GOSSIP_SYSFS_DEBUG
,
511 "sysfs_service_op_store: id:%s:\n",
514 new_op
= op_alloc(ORANGEFS_VFS_OP_PARAM
);
516 return -EINVAL
; /* sic */
518 /* Can't do a service_operation if the client is not running... */
519 rc
= is_daemon_in_service();
521 pr_info("%s: Client not running :%d:\n",
523 is_daemon_in_service());
528 * The value we want to send back to userspace is in buf, unless this
529 * there are two parameters, which is specially handled below.
531 if (strcmp(kobj
->name
, ORANGEFS_KOBJ_ID
) ||
532 strcmp(attr
->attr
.name
, "readahead_count_size")) {
533 rc
= kstrtoint(buf
, 0, &val
);
538 new_op
->upcall
.req
.param
.type
= ORANGEFS_PARAM_REQUEST_SET
;
540 if (!strcmp(kobj
->name
, ORANGEFS_KOBJ_ID
)) {
541 /* Drop unsupported requests first. */
542 if (!(orangefs_features
& ORANGEFS_FEATURE_READAHEAD
) &&
543 (!strcmp(attr
->attr
.name
, "readahead_count") ||
544 !strcmp(attr
->attr
.name
, "readahead_size") ||
545 !strcmp(attr
->attr
.name
, "readahead_count_size"))) {
550 if (!strcmp(attr
->attr
.name
, "perf_history_size")) {
552 new_op
->upcall
.req
.param
.op
=
553 ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE
;
558 } else if (!strcmp(attr
->attr
.name
,
559 "perf_time_interval_secs")) {
561 new_op
->upcall
.req
.param
.op
=
562 ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS
;
567 } else if (!strcmp(attr
->attr
.name
,
568 "perf_counter_reset")) {
569 if ((val
== 0) || (val
== 1)) {
570 new_op
->upcall
.req
.param
.op
=
571 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET
;
576 } else if (!strcmp(attr
->attr
.name
,
577 "readahead_count")) {
579 new_op
->upcall
.req
.param
.op
=
580 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT
;
585 } else if (!strcmp(attr
->attr
.name
,
588 new_op
->upcall
.req
.param
.op
=
589 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE
;
594 } else if (!strcmp(attr
->attr
.name
,
595 "readahead_count_size")) {
597 rc
= sscanf(buf
, "%d %d", &val1
, &val2
);
602 if ((val1
>= 0) && (val2
>= 0)) {
603 new_op
->upcall
.req
.param
.op
=
604 ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE
;
609 new_op
->upcall
.req
.param
.u
.value32
[0] = val1
;
610 new_op
->upcall
.req
.param
.u
.value32
[1] = val2
;
614 } else if (!strcmp(kobj
->name
, ACACHE_KOBJ_ID
)) {
615 if (!strcmp(attr
->attr
.name
, "hard_limit")) {
617 new_op
->upcall
.req
.param
.op
=
618 ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT
;
623 } else if (!strcmp(attr
->attr
.name
, "soft_limit")) {
625 new_op
->upcall
.req
.param
.op
=
626 ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT
;
631 } else if (!strcmp(attr
->attr
.name
,
632 "reclaim_percentage")) {
633 if ((val
> -1) && (val
< 101)) {
634 new_op
->upcall
.req
.param
.op
=
635 ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE
;
640 } else if (!strcmp(attr
->attr
.name
, "timeout_msecs")) {
642 new_op
->upcall
.req
.param
.op
=
643 ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS
;
650 } else if (!strcmp(kobj
->name
, CAPCACHE_KOBJ_ID
)) {
651 if (!strcmp(attr
->attr
.name
, "hard_limit")) {
653 new_op
->upcall
.req
.param
.op
=
654 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT
;
659 } else if (!strcmp(attr
->attr
.name
, "soft_limit")) {
661 new_op
->upcall
.req
.param
.op
=
662 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT
;
667 } else if (!strcmp(attr
->attr
.name
,
668 "reclaim_percentage")) {
669 if ((val
> -1) && (val
< 101)) {
670 new_op
->upcall
.req
.param
.op
=
671 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE
;
676 } else if (!strcmp(attr
->attr
.name
, "timeout_secs")) {
678 new_op
->upcall
.req
.param
.op
=
679 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS
;
686 } else if (!strcmp(kobj
->name
, CCACHE_KOBJ_ID
)) {
687 if (!strcmp(attr
->attr
.name
, "hard_limit")) {
689 new_op
->upcall
.req
.param
.op
=
690 ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT
;
695 } else if (!strcmp(attr
->attr
.name
, "soft_limit")) {
697 new_op
->upcall
.req
.param
.op
=
698 ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT
;
703 } else if (!strcmp(attr
->attr
.name
,
704 "reclaim_percentage")) {
705 if ((val
> -1) && (val
< 101)) {
706 new_op
->upcall
.req
.param
.op
=
707 ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE
;
712 } else if (!strcmp(attr
->attr
.name
, "timeout_secs")) {
714 new_op
->upcall
.req
.param
.op
=
715 ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS
;
722 } else if (!strcmp(kobj
->name
, NCACHE_KOBJ_ID
)) {
723 if (!strcmp(attr
->attr
.name
, "hard_limit")) {
725 new_op
->upcall
.req
.param
.op
=
726 ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT
;
731 } else if (!strcmp(attr
->attr
.name
, "soft_limit")) {
733 new_op
->upcall
.req
.param
.op
=
734 ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT
;
739 } else if (!strcmp(attr
->attr
.name
,
740 "reclaim_percentage")) {
741 if ((val
> -1) && (val
< 101)) {
742 new_op
->upcall
.req
.param
.op
=
743 ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE
;
748 } else if (!strcmp(attr
->attr
.name
, "timeout_msecs")) {
750 new_op
->upcall
.req
.param
.op
=
751 ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS
;
759 gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n",
765 new_op
->upcall
.req
.param
.u
.value64
= val
;
769 * The service_operation will return a errno return code on
770 * error, and zero on success.
772 rc
= service_operation(new_op
, "orangefs_param", ORANGEFS_OP_INTERRUPTIBLE
);
775 gossip_err("sysfs_service_op_store: service op returned:%d:\n",
785 if (rc
== -ENOMEM
|| rc
== 0)
791 static struct orangefs_attribute op_timeout_secs_attribute
=
792 __ATTR(op_timeout_secs
, 0664, sysfs_int_show
, sysfs_int_store
);
794 static struct orangefs_attribute slot_timeout_secs_attribute
=
795 __ATTR(slot_timeout_secs
, 0664, sysfs_int_show
, sysfs_int_store
);
797 static struct orangefs_attribute dcache_timeout_msecs_attribute
=
798 __ATTR(dcache_timeout_msecs
, 0664, sysfs_int_show
, sysfs_int_store
);
800 static struct orangefs_attribute getattr_timeout_msecs_attribute
=
801 __ATTR(getattr_timeout_msecs
, 0664, sysfs_int_show
, sysfs_int_store
);
803 static struct orangefs_attribute readahead_count_attribute
=
804 __ATTR(readahead_count
, 0664, sysfs_service_op_show
,
805 sysfs_service_op_store
);
807 static struct orangefs_attribute readahead_size_attribute
=
808 __ATTR(readahead_size
, 0664, sysfs_service_op_show
,
809 sysfs_service_op_store
);
811 static struct orangefs_attribute readahead_count_size_attribute
=
812 __ATTR(readahead_count_size
, 0664, sysfs_service_op_show
,
813 sysfs_service_op_store
);
815 static struct orangefs_attribute perf_counter_reset_attribute
=
816 __ATTR(perf_counter_reset
,
818 sysfs_service_op_show
,
819 sysfs_service_op_store
);
821 static struct orangefs_attribute perf_history_size_attribute
=
822 __ATTR(perf_history_size
,
824 sysfs_service_op_show
,
825 sysfs_service_op_store
);
827 static struct orangefs_attribute perf_time_interval_secs_attribute
=
828 __ATTR(perf_time_interval_secs
,
830 sysfs_service_op_show
,
831 sysfs_service_op_store
);
833 static struct attribute
*orangefs_default_attrs
[] = {
834 &op_timeout_secs_attribute
.attr
,
835 &slot_timeout_secs_attribute
.attr
,
836 &dcache_timeout_msecs_attribute
.attr
,
837 &getattr_timeout_msecs_attribute
.attr
,
838 &readahead_count_attribute
.attr
,
839 &readahead_size_attribute
.attr
,
840 &readahead_count_size_attribute
.attr
,
841 &perf_counter_reset_attribute
.attr
,
842 &perf_history_size_attribute
.attr
,
843 &perf_time_interval_secs_attribute
.attr
,
847 static struct kobj_type orangefs_ktype
= {
848 .sysfs_ops
= &orangefs_sysfs_ops
,
849 .default_attrs
= orangefs_default_attrs
,
852 static struct orangefs_attribute acache_hard_limit_attribute
=
855 sysfs_service_op_show
,
856 sysfs_service_op_store
);
858 static struct orangefs_attribute acache_reclaim_percent_attribute
=
859 __ATTR(reclaim_percentage
,
861 sysfs_service_op_show
,
862 sysfs_service_op_store
);
864 static struct orangefs_attribute acache_soft_limit_attribute
=
867 sysfs_service_op_show
,
868 sysfs_service_op_store
);
870 static struct orangefs_attribute acache_timeout_msecs_attribute
=
871 __ATTR(timeout_msecs
,
873 sysfs_service_op_show
,
874 sysfs_service_op_store
);
876 static struct attribute
*acache_orangefs_default_attrs
[] = {
877 &acache_hard_limit_attribute
.attr
,
878 &acache_reclaim_percent_attribute
.attr
,
879 &acache_soft_limit_attribute
.attr
,
880 &acache_timeout_msecs_attribute
.attr
,
884 static struct kobj_type acache_orangefs_ktype
= {
885 .sysfs_ops
= &orangefs_sysfs_ops
,
886 .default_attrs
= acache_orangefs_default_attrs
,
889 static struct orangefs_attribute capcache_hard_limit_attribute
=
892 sysfs_service_op_show
,
893 sysfs_service_op_store
);
895 static struct orangefs_attribute capcache_reclaim_percent_attribute
=
896 __ATTR(reclaim_percentage
,
898 sysfs_service_op_show
,
899 sysfs_service_op_store
);
901 static struct orangefs_attribute capcache_soft_limit_attribute
=
904 sysfs_service_op_show
,
905 sysfs_service_op_store
);
907 static struct orangefs_attribute capcache_timeout_secs_attribute
=
910 sysfs_service_op_show
,
911 sysfs_service_op_store
);
913 static struct attribute
*capcache_orangefs_default_attrs
[] = {
914 &capcache_hard_limit_attribute
.attr
,
915 &capcache_reclaim_percent_attribute
.attr
,
916 &capcache_soft_limit_attribute
.attr
,
917 &capcache_timeout_secs_attribute
.attr
,
921 static struct kobj_type capcache_orangefs_ktype
= {
922 .sysfs_ops
= &orangefs_sysfs_ops
,
923 .default_attrs
= capcache_orangefs_default_attrs
,
926 static struct orangefs_attribute ccache_hard_limit_attribute
=
929 sysfs_service_op_show
,
930 sysfs_service_op_store
);
932 static struct orangefs_attribute ccache_reclaim_percent_attribute
=
933 __ATTR(reclaim_percentage
,
935 sysfs_service_op_show
,
936 sysfs_service_op_store
);
938 static struct orangefs_attribute ccache_soft_limit_attribute
=
941 sysfs_service_op_show
,
942 sysfs_service_op_store
);
944 static struct orangefs_attribute ccache_timeout_secs_attribute
=
947 sysfs_service_op_show
,
948 sysfs_service_op_store
);
950 static struct attribute
*ccache_orangefs_default_attrs
[] = {
951 &ccache_hard_limit_attribute
.attr
,
952 &ccache_reclaim_percent_attribute
.attr
,
953 &ccache_soft_limit_attribute
.attr
,
954 &ccache_timeout_secs_attribute
.attr
,
958 static struct kobj_type ccache_orangefs_ktype
= {
959 .sysfs_ops
= &orangefs_sysfs_ops
,
960 .default_attrs
= ccache_orangefs_default_attrs
,
963 static struct orangefs_attribute ncache_hard_limit_attribute
=
966 sysfs_service_op_show
,
967 sysfs_service_op_store
);
969 static struct orangefs_attribute ncache_reclaim_percent_attribute
=
970 __ATTR(reclaim_percentage
,
972 sysfs_service_op_show
,
973 sysfs_service_op_store
);
975 static struct orangefs_attribute ncache_soft_limit_attribute
=
978 sysfs_service_op_show
,
979 sysfs_service_op_store
);
981 static struct orangefs_attribute ncache_timeout_msecs_attribute
=
982 __ATTR(timeout_msecs
,
984 sysfs_service_op_show
,
985 sysfs_service_op_store
);
987 static struct attribute
*ncache_orangefs_default_attrs
[] = {
988 &ncache_hard_limit_attribute
.attr
,
989 &ncache_reclaim_percent_attribute
.attr
,
990 &ncache_soft_limit_attribute
.attr
,
991 &ncache_timeout_msecs_attribute
.attr
,
995 static struct kobj_type ncache_orangefs_ktype
= {
996 .sysfs_ops
= &orangefs_sysfs_ops
,
997 .default_attrs
= ncache_orangefs_default_attrs
,
1000 static struct orangefs_attribute pc_acache_attribute
=
1003 sysfs_service_op_show
,
1006 static struct orangefs_attribute pc_capcache_attribute
=
1009 sysfs_service_op_show
,
1012 static struct orangefs_attribute pc_ncache_attribute
=
1015 sysfs_service_op_show
,
1018 static struct attribute
*pc_orangefs_default_attrs
[] = {
1019 &pc_acache_attribute
.attr
,
1020 &pc_capcache_attribute
.attr
,
1021 &pc_ncache_attribute
.attr
,
1025 static struct kobj_type pc_orangefs_ktype
= {
1026 .sysfs_ops
= &orangefs_sysfs_ops
,
1027 .default_attrs
= pc_orangefs_default_attrs
,
1030 static struct orangefs_attribute stats_reads_attribute
=
1036 static struct orangefs_attribute stats_writes_attribute
=
1042 static struct attribute
*stats_orangefs_default_attrs
[] = {
1043 &stats_reads_attribute
.attr
,
1044 &stats_writes_attribute
.attr
,
1048 static struct kobj_type stats_orangefs_ktype
= {
1049 .sysfs_ops
= &orangefs_sysfs_ops
,
1050 .default_attrs
= stats_orangefs_default_attrs
,
1053 static struct kobject
*orangefs_obj
;
1054 static struct kobject
*acache_orangefs_obj
;
1055 static struct kobject
*capcache_orangefs_obj
;
1056 static struct kobject
*ccache_orangefs_obj
;
1057 static struct kobject
*ncache_orangefs_obj
;
1058 static struct kobject
*pc_orangefs_obj
;
1059 static struct kobject
*stats_orangefs_obj
;
1061 int orangefs_sysfs_init(void)
1065 gossip_debug(GOSSIP_SYSFS_DEBUG
, "orangefs_sysfs_init: start\n");
1067 /* create /sys/fs/orangefs. */
1068 orangefs_obj
= kzalloc(sizeof(*orangefs_obj
), GFP_KERNEL
);
1072 rc
= kobject_init_and_add(orangefs_obj
,
1080 kobject_uevent(orangefs_obj
, KOBJ_ADD
);
1082 /* create /sys/fs/orangefs/acache. */
1083 acache_orangefs_obj
= kzalloc(sizeof(*acache_orangefs_obj
), GFP_KERNEL
);
1084 if (!acache_orangefs_obj
) {
1089 rc
= kobject_init_and_add(acache_orangefs_obj
,
1090 &acache_orangefs_ktype
,
1095 goto acache_obj_bail
;
1097 kobject_uevent(acache_orangefs_obj
, KOBJ_ADD
);
1099 /* create /sys/fs/orangefs/capcache. */
1100 capcache_orangefs_obj
=
1101 kzalloc(sizeof(*capcache_orangefs_obj
), GFP_KERNEL
);
1102 if (!capcache_orangefs_obj
) {
1104 goto acache_obj_bail
;
1107 rc
= kobject_init_and_add(capcache_orangefs_obj
,
1108 &capcache_orangefs_ktype
,
1112 goto capcache_obj_bail
;
1114 kobject_uevent(capcache_orangefs_obj
, KOBJ_ADD
);
1116 /* create /sys/fs/orangefs/ccache. */
1117 ccache_orangefs_obj
=
1118 kzalloc(sizeof(*ccache_orangefs_obj
), GFP_KERNEL
);
1119 if (!ccache_orangefs_obj
) {
1121 goto capcache_obj_bail
;
1124 rc
= kobject_init_and_add(ccache_orangefs_obj
,
1125 &ccache_orangefs_ktype
,
1129 goto ccache_obj_bail
;
1131 kobject_uevent(ccache_orangefs_obj
, KOBJ_ADD
);
1133 /* create /sys/fs/orangefs/ncache. */
1134 ncache_orangefs_obj
= kzalloc(sizeof(*ncache_orangefs_obj
), GFP_KERNEL
);
1135 if (!ncache_orangefs_obj
) {
1137 goto ccache_obj_bail
;
1140 rc
= kobject_init_and_add(ncache_orangefs_obj
,
1141 &ncache_orangefs_ktype
,
1146 goto ncache_obj_bail
;
1148 kobject_uevent(ncache_orangefs_obj
, KOBJ_ADD
);
1150 /* create /sys/fs/orangefs/perf_counters. */
1151 pc_orangefs_obj
= kzalloc(sizeof(*pc_orangefs_obj
), GFP_KERNEL
);
1152 if (!pc_orangefs_obj
) {
1154 goto ncache_obj_bail
;
1157 rc
= kobject_init_and_add(pc_orangefs_obj
,
1165 kobject_uevent(pc_orangefs_obj
, KOBJ_ADD
);
1167 /* create /sys/fs/orangefs/stats. */
1168 stats_orangefs_obj
= kzalloc(sizeof(*stats_orangefs_obj
), GFP_KERNEL
);
1169 if (!stats_orangefs_obj
) {
1174 rc
= kobject_init_and_add(stats_orangefs_obj
,
1175 &stats_orangefs_ktype
,
1180 goto stats_obj_bail
;
1182 kobject_uevent(stats_orangefs_obj
, KOBJ_ADD
);
1186 kobject_put(stats_orangefs_obj
);
1188 kobject_put(pc_orangefs_obj
);
1190 kobject_put(ncache_orangefs_obj
);
1192 kobject_put(ccache_orangefs_obj
);
1194 kobject_put(capcache_orangefs_obj
);
1196 kobject_put(acache_orangefs_obj
);
1198 kobject_put(orangefs_obj
);
1203 void orangefs_sysfs_exit(void)
1205 gossip_debug(GOSSIP_SYSFS_DEBUG
, "orangefs_sysfs_exit: start\n");
1206 kobject_put(acache_orangefs_obj
);
1207 kobject_put(capcache_orangefs_obj
);
1208 kobject_put(ccache_orangefs_obj
);
1209 kobject_put(ncache_orangefs_obj
);
1210 kobject_put(pc_orangefs_obj
);
1211 kobject_put(stats_orangefs_obj
);
1212 kobject_put(orangefs_obj
);