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.
65 * What: /sys/fs/orangefs/acache/...
67 * Contact: Mike Marshall <hubcap@omnibond.com>
69 * Attribute cache configurable settings.
72 * What: /sys/fs/orangefs/ncache/...
74 * Contact: Mike Marshall <hubcap@omnibond.com>
76 * Name cache configurable settings.
79 * What: /sys/fs/orangefs/capcache/...
81 * Contact: Mike Marshall <hubcap@omnibond.com>
83 * Capability cache configurable settings.
86 * What: /sys/fs/orangefs/ccache/...
88 * Contact: Mike Marshall <hubcap@omnibond.com>
90 * Credential cache configurable settings.
95 #include <linux/kobject.h>
96 #include <linux/string.h>
97 #include <linux/sysfs.h>
98 #include <linux/module.h>
99 #include <linux/init.h>
101 #include "protocol.h"
102 #include "orangefs-kernel.h"
103 #include "orangefs-sysfs.h"
105 #define ORANGEFS_KOBJ_ID "orangefs"
106 #define ACACHE_KOBJ_ID "acache"
107 #define CAPCACHE_KOBJ_ID "capcache"
108 #define CCACHE_KOBJ_ID "ccache"
109 #define NCACHE_KOBJ_ID "ncache"
110 #define PC_KOBJ_ID "pc"
111 #define STATS_KOBJ_ID "stats"
113 struct orangefs_obj
{
116 int perf_counter_reset
;
117 int perf_history_size
;
118 int perf_time_interval_secs
;
119 int slot_timeout_secs
;
122 struct acache_orangefs_obj
{
125 int reclaim_percentage
;
130 struct capcache_orangefs_obj
{
133 int reclaim_percentage
;
138 struct ccache_orangefs_obj
{
141 int reclaim_percentage
;
146 struct ncache_orangefs_obj
{
149 int reclaim_percentage
;
154 struct pc_orangefs_obj
{
161 struct stats_orangefs_obj
{
167 struct orangefs_attribute
{
168 struct attribute attr
;
169 ssize_t (*show
)(struct orangefs_obj
*orangefs_obj
,
170 struct orangefs_attribute
*attr
,
172 ssize_t (*store
)(struct orangefs_obj
*orangefs_obj
,
173 struct orangefs_attribute
*attr
,
178 struct acache_orangefs_attribute
{
179 struct attribute attr
;
180 ssize_t (*show
)(struct acache_orangefs_obj
*acache_orangefs_obj
,
181 struct acache_orangefs_attribute
*attr
,
183 ssize_t (*store
)(struct acache_orangefs_obj
*acache_orangefs_obj
,
184 struct acache_orangefs_attribute
*attr
,
189 struct capcache_orangefs_attribute
{
190 struct attribute attr
;
191 ssize_t (*show
)(struct capcache_orangefs_obj
*capcache_orangefs_obj
,
192 struct capcache_orangefs_attribute
*attr
,
194 ssize_t (*store
)(struct capcache_orangefs_obj
*capcache_orangefs_obj
,
195 struct capcache_orangefs_attribute
*attr
,
200 struct ccache_orangefs_attribute
{
201 struct attribute attr
;
202 ssize_t (*show
)(struct ccache_orangefs_obj
*ccache_orangefs_obj
,
203 struct ccache_orangefs_attribute
*attr
,
205 ssize_t (*store
)(struct ccache_orangefs_obj
*ccache_orangefs_obj
,
206 struct ccache_orangefs_attribute
*attr
,
211 struct ncache_orangefs_attribute
{
212 struct attribute attr
;
213 ssize_t (*show
)(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
214 struct ncache_orangefs_attribute
*attr
,
216 ssize_t (*store
)(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
217 struct ncache_orangefs_attribute
*attr
,
222 struct pc_orangefs_attribute
{
223 struct attribute attr
;
224 ssize_t (*show
)(struct pc_orangefs_obj
*pc_orangefs_obj
,
225 struct pc_orangefs_attribute
*attr
,
227 ssize_t (*store
)(struct pc_orangefs_obj
*pc_orangefs_obj
,
228 struct pc_orangefs_attribute
*attr
,
233 struct stats_orangefs_attribute
{
234 struct attribute attr
;
235 ssize_t (*show
)(struct stats_orangefs_obj
*stats_orangefs_obj
,
236 struct stats_orangefs_attribute
*attr
,
238 ssize_t (*store
)(struct stats_orangefs_obj
*stats_orangefs_obj
,
239 struct stats_orangefs_attribute
*attr
,
244 static ssize_t
orangefs_attr_show(struct kobject
*kobj
,
245 struct attribute
*attr
,
248 struct orangefs_attribute
*attribute
;
249 struct orangefs_obj
*orangefs_obj
;
252 attribute
= container_of(attr
, struct orangefs_attribute
, attr
);
253 orangefs_obj
= container_of(kobj
, struct orangefs_obj
, kobj
);
255 if (!attribute
->show
) {
260 rc
= attribute
->show(orangefs_obj
, attribute
, buf
);
266 static ssize_t
orangefs_attr_store(struct kobject
*kobj
,
267 struct attribute
*attr
,
271 struct orangefs_attribute
*attribute
;
272 struct orangefs_obj
*orangefs_obj
;
275 gossip_debug(GOSSIP_SYSFS_DEBUG
,
276 "orangefs_attr_store: start\n");
278 attribute
= container_of(attr
, struct orangefs_attribute
, attr
);
279 orangefs_obj
= container_of(kobj
, struct orangefs_obj
, kobj
);
281 if (!attribute
->store
) {
286 rc
= attribute
->store(orangefs_obj
, attribute
, buf
, len
);
292 static const struct sysfs_ops orangefs_sysfs_ops
= {
293 .show
= orangefs_attr_show
,
294 .store
= orangefs_attr_store
,
297 static ssize_t
acache_orangefs_attr_show(struct kobject
*kobj
,
298 struct attribute
*attr
,
301 struct acache_orangefs_attribute
*attribute
;
302 struct acache_orangefs_obj
*acache_orangefs_obj
;
305 attribute
= container_of(attr
, struct acache_orangefs_attribute
, attr
);
306 acache_orangefs_obj
=
307 container_of(kobj
, struct acache_orangefs_obj
, kobj
);
309 if (!attribute
->show
) {
314 rc
= attribute
->show(acache_orangefs_obj
, attribute
, buf
);
320 static ssize_t
acache_orangefs_attr_store(struct kobject
*kobj
,
321 struct attribute
*attr
,
325 struct acache_orangefs_attribute
*attribute
;
326 struct acache_orangefs_obj
*acache_orangefs_obj
;
329 gossip_debug(GOSSIP_SYSFS_DEBUG
,
330 "acache_orangefs_attr_store: start\n");
332 attribute
= container_of(attr
, struct acache_orangefs_attribute
, attr
);
333 acache_orangefs_obj
=
334 container_of(kobj
, struct acache_orangefs_obj
, kobj
);
336 if (!attribute
->store
) {
341 rc
= attribute
->store(acache_orangefs_obj
, attribute
, buf
, len
);
347 static const struct sysfs_ops acache_orangefs_sysfs_ops
= {
348 .show
= acache_orangefs_attr_show
,
349 .store
= acache_orangefs_attr_store
,
352 static ssize_t
capcache_orangefs_attr_show(struct kobject
*kobj
,
353 struct attribute
*attr
,
356 struct capcache_orangefs_attribute
*attribute
;
357 struct capcache_orangefs_obj
*capcache_orangefs_obj
;
361 container_of(attr
, struct capcache_orangefs_attribute
, attr
);
362 capcache_orangefs_obj
=
363 container_of(kobj
, struct capcache_orangefs_obj
, kobj
);
365 if (!attribute
->show
) {
370 rc
= attribute
->show(capcache_orangefs_obj
, attribute
, buf
);
376 static ssize_t
capcache_orangefs_attr_store(struct kobject
*kobj
,
377 struct attribute
*attr
,
381 struct capcache_orangefs_attribute
*attribute
;
382 struct capcache_orangefs_obj
*capcache_orangefs_obj
;
385 gossip_debug(GOSSIP_SYSFS_DEBUG
,
386 "capcache_orangefs_attr_store: start\n");
389 container_of(attr
, struct capcache_orangefs_attribute
, attr
);
390 capcache_orangefs_obj
=
391 container_of(kobj
, struct capcache_orangefs_obj
, kobj
);
393 if (!attribute
->store
) {
398 rc
= attribute
->store(capcache_orangefs_obj
, attribute
, buf
, len
);
404 static const struct sysfs_ops capcache_orangefs_sysfs_ops
= {
405 .show
= capcache_orangefs_attr_show
,
406 .store
= capcache_orangefs_attr_store
,
409 static ssize_t
ccache_orangefs_attr_show(struct kobject
*kobj
,
410 struct attribute
*attr
,
413 struct ccache_orangefs_attribute
*attribute
;
414 struct ccache_orangefs_obj
*ccache_orangefs_obj
;
418 container_of(attr
, struct ccache_orangefs_attribute
, attr
);
419 ccache_orangefs_obj
=
420 container_of(kobj
, struct ccache_orangefs_obj
, kobj
);
422 if (!attribute
->show
) {
427 rc
= attribute
->show(ccache_orangefs_obj
, attribute
, buf
);
433 static ssize_t
ccache_orangefs_attr_store(struct kobject
*kobj
,
434 struct attribute
*attr
,
438 struct ccache_orangefs_attribute
*attribute
;
439 struct ccache_orangefs_obj
*ccache_orangefs_obj
;
442 gossip_debug(GOSSIP_SYSFS_DEBUG
,
443 "ccache_orangefs_attr_store: start\n");
446 container_of(attr
, struct ccache_orangefs_attribute
, attr
);
447 ccache_orangefs_obj
=
448 container_of(kobj
, struct ccache_orangefs_obj
, kobj
);
450 if (!attribute
->store
) {
455 rc
= attribute
->store(ccache_orangefs_obj
, attribute
, buf
, len
);
461 static const struct sysfs_ops ccache_orangefs_sysfs_ops
= {
462 .show
= ccache_orangefs_attr_show
,
463 .store
= ccache_orangefs_attr_store
,
466 static ssize_t
ncache_orangefs_attr_show(struct kobject
*kobj
,
467 struct attribute
*attr
,
470 struct ncache_orangefs_attribute
*attribute
;
471 struct ncache_orangefs_obj
*ncache_orangefs_obj
;
474 attribute
= container_of(attr
, struct ncache_orangefs_attribute
, attr
);
475 ncache_orangefs_obj
=
476 container_of(kobj
, struct ncache_orangefs_obj
, kobj
);
478 if (!attribute
->show
) {
483 rc
= attribute
->show(ncache_orangefs_obj
, attribute
, buf
);
489 static ssize_t
ncache_orangefs_attr_store(struct kobject
*kobj
,
490 struct attribute
*attr
,
494 struct ncache_orangefs_attribute
*attribute
;
495 struct ncache_orangefs_obj
*ncache_orangefs_obj
;
498 gossip_debug(GOSSIP_SYSFS_DEBUG
,
499 "ncache_orangefs_attr_store: start\n");
501 attribute
= container_of(attr
, struct ncache_orangefs_attribute
, attr
);
502 ncache_orangefs_obj
=
503 container_of(kobj
, struct ncache_orangefs_obj
, kobj
);
505 if (!attribute
->store
) {
510 rc
= attribute
->store(ncache_orangefs_obj
, attribute
, buf
, len
);
516 static const struct sysfs_ops ncache_orangefs_sysfs_ops
= {
517 .show
= ncache_orangefs_attr_show
,
518 .store
= ncache_orangefs_attr_store
,
521 static ssize_t
pc_orangefs_attr_show(struct kobject
*kobj
,
522 struct attribute
*attr
,
525 struct pc_orangefs_attribute
*attribute
;
526 struct pc_orangefs_obj
*pc_orangefs_obj
;
529 attribute
= container_of(attr
, struct pc_orangefs_attribute
, attr
);
531 container_of(kobj
, struct pc_orangefs_obj
, kobj
);
533 if (!attribute
->show
) {
538 rc
= attribute
->show(pc_orangefs_obj
, attribute
, buf
);
544 static const struct sysfs_ops pc_orangefs_sysfs_ops
= {
545 .show
= pc_orangefs_attr_show
,
548 static ssize_t
stats_orangefs_attr_show(struct kobject
*kobj
,
549 struct attribute
*attr
,
552 struct stats_orangefs_attribute
*attribute
;
553 struct stats_orangefs_obj
*stats_orangefs_obj
;
556 attribute
= container_of(attr
, struct stats_orangefs_attribute
, attr
);
558 container_of(kobj
, struct stats_orangefs_obj
, kobj
);
560 if (!attribute
->show
) {
565 rc
= attribute
->show(stats_orangefs_obj
, attribute
, buf
);
571 static const struct sysfs_ops stats_orangefs_sysfs_ops
= {
572 .show
= stats_orangefs_attr_show
,
575 static void orangefs_release(struct kobject
*kobj
)
577 struct orangefs_obj
*orangefs_obj
;
579 orangefs_obj
= container_of(kobj
, struct orangefs_obj
, kobj
);
583 static void acache_orangefs_release(struct kobject
*kobj
)
585 struct acache_orangefs_obj
*acache_orangefs_obj
;
587 acache_orangefs_obj
=
588 container_of(kobj
, struct acache_orangefs_obj
, kobj
);
589 kfree(acache_orangefs_obj
);
592 static void capcache_orangefs_release(struct kobject
*kobj
)
594 struct capcache_orangefs_obj
*capcache_orangefs_obj
;
596 capcache_orangefs_obj
=
597 container_of(kobj
, struct capcache_orangefs_obj
, kobj
);
598 kfree(capcache_orangefs_obj
);
601 static void ccache_orangefs_release(struct kobject
*kobj
)
603 struct ccache_orangefs_obj
*ccache_orangefs_obj
;
605 ccache_orangefs_obj
=
606 container_of(kobj
, struct ccache_orangefs_obj
, kobj
);
607 kfree(ccache_orangefs_obj
);
610 static void ncache_orangefs_release(struct kobject
*kobj
)
612 struct ncache_orangefs_obj
*ncache_orangefs_obj
;
614 ncache_orangefs_obj
=
615 container_of(kobj
, struct ncache_orangefs_obj
, kobj
);
616 kfree(ncache_orangefs_obj
);
619 static void pc_orangefs_release(struct kobject
*kobj
)
621 struct pc_orangefs_obj
*pc_orangefs_obj
;
624 container_of(kobj
, struct pc_orangefs_obj
, kobj
);
625 kfree(pc_orangefs_obj
);
628 static void stats_orangefs_release(struct kobject
*kobj
)
630 struct stats_orangefs_obj
*stats_orangefs_obj
;
633 container_of(kobj
, struct stats_orangefs_obj
, kobj
);
634 kfree(stats_orangefs_obj
);
637 static ssize_t
sysfs_int_show(char *kobj_id
, char *buf
, void *attr
)
640 struct orangefs_attribute
*orangefs_attr
;
641 struct stats_orangefs_attribute
*stats_orangefs_attr
;
643 gossip_debug(GOSSIP_SYSFS_DEBUG
, "sysfs_int_show: id:%s:\n", kobj_id
);
645 if (!strcmp(kobj_id
, ORANGEFS_KOBJ_ID
)) {
646 orangefs_attr
= (struct orangefs_attribute
*)attr
;
648 if (!strcmp(orangefs_attr
->attr
.name
, "op_timeout_secs")) {
654 } else if (!strcmp(orangefs_attr
->attr
.name
,
655 "slot_timeout_secs")) {
665 } else if (!strcmp(kobj_id
, STATS_KOBJ_ID
)) {
666 stats_orangefs_attr
= (struct stats_orangefs_attribute
*)attr
;
668 if (!strcmp(stats_orangefs_attr
->attr
.name
, "reads")) {
672 g_orangefs_stats
.reads
);
674 } else if (!strcmp(stats_orangefs_attr
->attr
.name
, "writes")) {
678 g_orangefs_stats
.writes
);
690 static ssize_t
int_orangefs_show(struct orangefs_obj
*orangefs_obj
,
691 struct orangefs_attribute
*attr
,
696 gossip_debug(GOSSIP_SYSFS_DEBUG
,
697 "int_orangefs_show:start attr->attr.name:%s:\n",
700 rc
= sysfs_int_show(ORANGEFS_KOBJ_ID
, buf
, (void *) attr
);
705 static ssize_t
int_stats_show(struct stats_orangefs_obj
*stats_orangefs_obj
,
706 struct stats_orangefs_attribute
*attr
,
711 gossip_debug(GOSSIP_SYSFS_DEBUG
,
712 "int_stats_show:start attr->attr.name:%s:\n",
715 rc
= sysfs_int_show(STATS_KOBJ_ID
, buf
, (void *) attr
);
720 static ssize_t
int_store(struct orangefs_obj
*orangefs_obj
,
721 struct orangefs_attribute
*attr
,
727 gossip_debug(GOSSIP_SYSFS_DEBUG
,
728 "int_store: start attr->attr.name:%s: buf:%s:\n",
729 attr
->attr
.name
, buf
);
731 if (!strcmp(attr
->attr
.name
, "op_timeout_secs")) {
732 rc
= kstrtoint(buf
, 0, &op_timeout_secs
);
734 } else if (!strcmp(attr
->attr
.name
, "slot_timeout_secs")) {
735 rc
= kstrtoint(buf
, 0, &slot_timeout_secs
);
751 * obtain attribute values from userspace with a service operation.
753 static int sysfs_service_op_show(char *kobj_id
, char *buf
, void *attr
)
755 struct orangefs_kernel_op_s
*new_op
= NULL
;
757 char *ser_op_type
= NULL
;
758 struct orangefs_attribute
*orangefs_attr
;
759 struct acache_orangefs_attribute
*acache_attr
;
760 struct capcache_orangefs_attribute
*capcache_attr
;
761 struct ccache_orangefs_attribute
*ccache_attr
;
762 struct ncache_orangefs_attribute
*ncache_attr
;
763 struct pc_orangefs_attribute
*pc_attr
;
766 gossip_debug(GOSSIP_SYSFS_DEBUG
,
767 "sysfs_service_op_show: id:%s:\n",
770 if (strcmp(kobj_id
, PC_KOBJ_ID
))
771 op_alloc_type
= ORANGEFS_VFS_OP_PARAM
;
773 op_alloc_type
= ORANGEFS_VFS_OP_PERF_COUNT
;
775 new_op
= op_alloc(op_alloc_type
);
779 /* Can't do a service_operation if the client is not running... */
780 rc
= is_daemon_in_service();
782 pr_info("%s: Client not running :%d:\n",
784 is_daemon_in_service());
788 if (strcmp(kobj_id
, PC_KOBJ_ID
))
789 new_op
->upcall
.req
.param
.type
= ORANGEFS_PARAM_REQUEST_GET
;
791 if (!strcmp(kobj_id
, ORANGEFS_KOBJ_ID
)) {
792 orangefs_attr
= (struct orangefs_attribute
*)attr
;
794 if (!strcmp(orangefs_attr
->attr
.name
, "perf_history_size"))
795 new_op
->upcall
.req
.param
.op
=
796 ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE
;
797 else if (!strcmp(orangefs_attr
->attr
.name
,
798 "perf_time_interval_secs"))
799 new_op
->upcall
.req
.param
.op
=
800 ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS
;
801 else if (!strcmp(orangefs_attr
->attr
.name
,
802 "perf_counter_reset"))
803 new_op
->upcall
.req
.param
.op
=
804 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET
;
806 } else if (!strcmp(kobj_id
, ACACHE_KOBJ_ID
)) {
807 acache_attr
= (struct acache_orangefs_attribute
*)attr
;
809 if (!strcmp(acache_attr
->attr
.name
, "timeout_msecs"))
810 new_op
->upcall
.req
.param
.op
=
811 ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS
;
813 if (!strcmp(acache_attr
->attr
.name
, "hard_limit"))
814 new_op
->upcall
.req
.param
.op
=
815 ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT
;
817 if (!strcmp(acache_attr
->attr
.name
, "soft_limit"))
818 new_op
->upcall
.req
.param
.op
=
819 ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT
;
821 if (!strcmp(acache_attr
->attr
.name
, "reclaim_percentage"))
822 new_op
->upcall
.req
.param
.op
=
823 ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE
;
825 } else if (!strcmp(kobj_id
, CAPCACHE_KOBJ_ID
)) {
826 capcache_attr
= (struct capcache_orangefs_attribute
*)attr
;
828 if (!strcmp(capcache_attr
->attr
.name
, "timeout_secs"))
829 new_op
->upcall
.req
.param
.op
=
830 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS
;
832 if (!strcmp(capcache_attr
->attr
.name
, "hard_limit"))
833 new_op
->upcall
.req
.param
.op
=
834 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT
;
836 if (!strcmp(capcache_attr
->attr
.name
, "soft_limit"))
837 new_op
->upcall
.req
.param
.op
=
838 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT
;
840 if (!strcmp(capcache_attr
->attr
.name
, "reclaim_percentage"))
841 new_op
->upcall
.req
.param
.op
=
842 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE
;
844 } else if (!strcmp(kobj_id
, CCACHE_KOBJ_ID
)) {
845 ccache_attr
= (struct ccache_orangefs_attribute
*)attr
;
847 if (!strcmp(ccache_attr
->attr
.name
, "timeout_secs"))
848 new_op
->upcall
.req
.param
.op
=
849 ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS
;
851 if (!strcmp(ccache_attr
->attr
.name
, "hard_limit"))
852 new_op
->upcall
.req
.param
.op
=
853 ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT
;
855 if (!strcmp(ccache_attr
->attr
.name
, "soft_limit"))
856 new_op
->upcall
.req
.param
.op
=
857 ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT
;
859 if (!strcmp(ccache_attr
->attr
.name
, "reclaim_percentage"))
860 new_op
->upcall
.req
.param
.op
=
861 ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE
;
863 } else if (!strcmp(kobj_id
, NCACHE_KOBJ_ID
)) {
864 ncache_attr
= (struct ncache_orangefs_attribute
*)attr
;
866 if (!strcmp(ncache_attr
->attr
.name
, "timeout_msecs"))
867 new_op
->upcall
.req
.param
.op
=
868 ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS
;
870 if (!strcmp(ncache_attr
->attr
.name
, "hard_limit"))
871 new_op
->upcall
.req
.param
.op
=
872 ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT
;
874 if (!strcmp(ncache_attr
->attr
.name
, "soft_limit"))
875 new_op
->upcall
.req
.param
.op
=
876 ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT
;
878 if (!strcmp(ncache_attr
->attr
.name
, "reclaim_percentage"))
879 new_op
->upcall
.req
.param
.op
=
880 ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE
;
882 } else if (!strcmp(kobj_id
, PC_KOBJ_ID
)) {
883 pc_attr
= (struct pc_orangefs_attribute
*)attr
;
885 if (!strcmp(pc_attr
->attr
.name
, ACACHE_KOBJ_ID
))
886 new_op
->upcall
.req
.perf_count
.type
=
887 ORANGEFS_PERF_COUNT_REQUEST_ACACHE
;
889 if (!strcmp(pc_attr
->attr
.name
, CAPCACHE_KOBJ_ID
))
890 new_op
->upcall
.req
.perf_count
.type
=
891 ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE
;
893 if (!strcmp(pc_attr
->attr
.name
, NCACHE_KOBJ_ID
))
894 new_op
->upcall
.req
.perf_count
.type
=
895 ORANGEFS_PERF_COUNT_REQUEST_NCACHE
;
898 gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n",
905 if (strcmp(kobj_id
, PC_KOBJ_ID
))
906 ser_op_type
= "orangefs_param";
908 ser_op_type
= "orangefs_perf_count";
911 * The service_operation will return an errno return code on
912 * error, and zero on success.
914 rc
= service_operation(new_op
, ser_op_type
, ORANGEFS_OP_INTERRUPTIBLE
);
918 if (strcmp(kobj_id
, PC_KOBJ_ID
)) {
922 (int)new_op
->downcall
.resp
.param
.value
);
928 new_op
->downcall
.resp
.perf_count
.buffer
);
938 static ssize_t
service_orangefs_show(struct orangefs_obj
*orangefs_obj
,
939 struct orangefs_attribute
*attr
,
944 rc
= sysfs_service_op_show(ORANGEFS_KOBJ_ID
, buf
, (void *)attr
);
950 service_acache_show(struct acache_orangefs_obj
*acache_orangefs_obj
,
951 struct acache_orangefs_attribute
*attr
,
956 rc
= sysfs_service_op_show(ACACHE_KOBJ_ID
, buf
, (void *)attr
);
961 static ssize_t
service_capcache_show(struct capcache_orangefs_obj
962 *capcache_orangefs_obj
,
963 struct capcache_orangefs_attribute
*attr
,
968 rc
= sysfs_service_op_show(CAPCACHE_KOBJ_ID
, buf
, (void *)attr
);
973 static ssize_t
service_ccache_show(struct ccache_orangefs_obj
974 *ccache_orangefs_obj
,
975 struct ccache_orangefs_attribute
*attr
,
980 rc
= sysfs_service_op_show(CCACHE_KOBJ_ID
, buf
, (void *)attr
);
986 service_ncache_show(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
987 struct ncache_orangefs_attribute
*attr
,
992 rc
= sysfs_service_op_show(NCACHE_KOBJ_ID
, buf
, (void *)attr
);
998 service_pc_show(struct pc_orangefs_obj
*pc_orangefs_obj
,
999 struct pc_orangefs_attribute
*attr
,
1004 rc
= sysfs_service_op_show(PC_KOBJ_ID
, buf
, (void *)attr
);
1010 * pass attribute values back to userspace with a service operation.
1012 * We have to do a memory allocation, an sscanf and a service operation.
1013 * And we have to evaluate what the user entered, to make sure the
1014 * value is within the range supported by the attribute. So, there's
1015 * a lot of return code checking and mapping going on here.
1017 * We want to return 1 if we think everything went OK, and
1020 static int sysfs_service_op_store(char *kobj_id
, const char *buf
, void *attr
)
1022 struct orangefs_kernel_op_s
*new_op
= NULL
;
1025 struct orangefs_attribute
*orangefs_attr
;
1026 struct acache_orangefs_attribute
*acache_attr
;
1027 struct capcache_orangefs_attribute
*capcache_attr
;
1028 struct ccache_orangefs_attribute
*ccache_attr
;
1029 struct ncache_orangefs_attribute
*ncache_attr
;
1031 gossip_debug(GOSSIP_SYSFS_DEBUG
,
1032 "sysfs_service_op_store: id:%s:\n",
1035 new_op
= op_alloc(ORANGEFS_VFS_OP_PARAM
);
1037 return -EINVAL
; /* sic */
1039 /* Can't do a service_operation if the client is not running... */
1040 rc
= is_daemon_in_service();
1042 pr_info("%s: Client not running :%d:\n",
1044 is_daemon_in_service());
1049 * The value we want to send back to userspace is in buf.
1051 rc
= kstrtoint(buf
, 0, &val
);
1055 if (!strcmp(kobj_id
, ORANGEFS_KOBJ_ID
)) {
1056 orangefs_attr
= (struct orangefs_attribute
*)attr
;
1058 if (!strcmp(orangefs_attr
->attr
.name
, "perf_history_size")) {
1060 new_op
->upcall
.req
.param
.op
=
1061 ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE
;
1066 } else if (!strcmp(orangefs_attr
->attr
.name
,
1067 "perf_time_interval_secs")) {
1069 new_op
->upcall
.req
.param
.op
=
1070 ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS
;
1075 } else if (!strcmp(orangefs_attr
->attr
.name
,
1076 "perf_counter_reset")) {
1077 if ((val
== 0) || (val
== 1)) {
1078 new_op
->upcall
.req
.param
.op
=
1079 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET
;
1086 } else if (!strcmp(kobj_id
, ACACHE_KOBJ_ID
)) {
1087 acache_attr
= (struct acache_orangefs_attribute
*)attr
;
1089 if (!strcmp(acache_attr
->attr
.name
, "hard_limit")) {
1091 new_op
->upcall
.req
.param
.op
=
1092 ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT
;
1097 } else if (!strcmp(acache_attr
->attr
.name
, "soft_limit")) {
1099 new_op
->upcall
.req
.param
.op
=
1100 ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT
;
1105 } else if (!strcmp(acache_attr
->attr
.name
,
1106 "reclaim_percentage")) {
1107 if ((val
> -1) && (val
< 101)) {
1108 new_op
->upcall
.req
.param
.op
=
1109 ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE
;
1114 } else if (!strcmp(acache_attr
->attr
.name
, "timeout_msecs")) {
1116 new_op
->upcall
.req
.param
.op
=
1117 ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS
;
1124 } else if (!strcmp(kobj_id
, CAPCACHE_KOBJ_ID
)) {
1125 capcache_attr
= (struct capcache_orangefs_attribute
*)attr
;
1127 if (!strcmp(capcache_attr
->attr
.name
, "hard_limit")) {
1129 new_op
->upcall
.req
.param
.op
=
1130 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT
;
1135 } else if (!strcmp(capcache_attr
->attr
.name
, "soft_limit")) {
1137 new_op
->upcall
.req
.param
.op
=
1138 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT
;
1143 } else if (!strcmp(capcache_attr
->attr
.name
,
1144 "reclaim_percentage")) {
1145 if ((val
> -1) && (val
< 101)) {
1146 new_op
->upcall
.req
.param
.op
=
1147 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE
;
1152 } else if (!strcmp(capcache_attr
->attr
.name
, "timeout_secs")) {
1154 new_op
->upcall
.req
.param
.op
=
1155 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS
;
1162 } else if (!strcmp(kobj_id
, CCACHE_KOBJ_ID
)) {
1163 ccache_attr
= (struct ccache_orangefs_attribute
*)attr
;
1165 if (!strcmp(ccache_attr
->attr
.name
, "hard_limit")) {
1167 new_op
->upcall
.req
.param
.op
=
1168 ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT
;
1173 } else if (!strcmp(ccache_attr
->attr
.name
, "soft_limit")) {
1175 new_op
->upcall
.req
.param
.op
=
1176 ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT
;
1181 } else if (!strcmp(ccache_attr
->attr
.name
,
1182 "reclaim_percentage")) {
1183 if ((val
> -1) && (val
< 101)) {
1184 new_op
->upcall
.req
.param
.op
=
1185 ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE
;
1190 } else if (!strcmp(ccache_attr
->attr
.name
, "timeout_secs")) {
1192 new_op
->upcall
.req
.param
.op
=
1193 ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS
;
1200 } else if (!strcmp(kobj_id
, NCACHE_KOBJ_ID
)) {
1201 ncache_attr
= (struct ncache_orangefs_attribute
*)attr
;
1203 if (!strcmp(ncache_attr
->attr
.name
, "hard_limit")) {
1205 new_op
->upcall
.req
.param
.op
=
1206 ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT
;
1211 } else if (!strcmp(ncache_attr
->attr
.name
, "soft_limit")) {
1213 new_op
->upcall
.req
.param
.op
=
1214 ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT
;
1219 } else if (!strcmp(ncache_attr
->attr
.name
,
1220 "reclaim_percentage")) {
1221 if ((val
> -1) && (val
< 101)) {
1222 new_op
->upcall
.req
.param
.op
=
1223 ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE
;
1228 } else if (!strcmp(ncache_attr
->attr
.name
, "timeout_msecs")) {
1230 new_op
->upcall
.req
.param
.op
=
1231 ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS
;
1239 gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n",
1245 new_op
->upcall
.req
.param
.type
= ORANGEFS_PARAM_REQUEST_SET
;
1247 new_op
->upcall
.req
.param
.value
= val
;
1250 * The service_operation will return a errno return code on
1251 * error, and zero on success.
1253 rc
= service_operation(new_op
, "orangefs_param", ORANGEFS_OP_INTERRUPTIBLE
);
1256 gossip_err("sysfs_service_op_store: service op returned:%d:\n",
1266 if (rc
== -ENOMEM
|| rc
== 0)
1273 service_orangefs_store(struct orangefs_obj
*orangefs_obj
,
1274 struct orangefs_attribute
*attr
,
1280 rc
= sysfs_service_op_store(ORANGEFS_KOBJ_ID
, buf
, (void *) attr
);
1282 /* rc should have an errno value if the service_op went bad. */
1290 service_acache_store(struct acache_orangefs_obj
*acache_orangefs_obj
,
1291 struct acache_orangefs_attribute
*attr
,
1297 rc
= sysfs_service_op_store(ACACHE_KOBJ_ID
, buf
, (void *) attr
);
1299 /* rc should have an errno value if the service_op went bad. */
1307 service_capcache_store(struct capcache_orangefs_obj
1308 *capcache_orangefs_obj
,
1309 struct capcache_orangefs_attribute
*attr
,
1315 rc
= sysfs_service_op_store(CAPCACHE_KOBJ_ID
, buf
, (void *) attr
);
1317 /* rc should have an errno value if the service_op went bad. */
1324 static ssize_t
service_ccache_store(struct ccache_orangefs_obj
1325 *ccache_orangefs_obj
,
1326 struct ccache_orangefs_attribute
*attr
,
1332 rc
= sysfs_service_op_store(CCACHE_KOBJ_ID
, buf
, (void *) attr
);
1334 /* rc should have an errno value if the service_op went bad. */
1342 service_ncache_store(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
1343 struct ncache_orangefs_attribute
*attr
,
1349 rc
= sysfs_service_op_store(NCACHE_KOBJ_ID
, buf
, (void *) attr
);
1351 /* rc should have an errno value if the service_op went bad. */
1358 static struct orangefs_attribute op_timeout_secs_attribute
=
1359 __ATTR(op_timeout_secs
, 0664, int_orangefs_show
, int_store
);
1361 static struct orangefs_attribute slot_timeout_secs_attribute
=
1362 __ATTR(slot_timeout_secs
, 0664, int_orangefs_show
, int_store
);
1364 static struct orangefs_attribute perf_counter_reset_attribute
=
1365 __ATTR(perf_counter_reset
,
1367 service_orangefs_show
,
1368 service_orangefs_store
);
1370 static struct orangefs_attribute perf_history_size_attribute
=
1371 __ATTR(perf_history_size
,
1373 service_orangefs_show
,
1374 service_orangefs_store
);
1376 static struct orangefs_attribute perf_time_interval_secs_attribute
=
1377 __ATTR(perf_time_interval_secs
,
1379 service_orangefs_show
,
1380 service_orangefs_store
);
1382 static struct attribute
*orangefs_default_attrs
[] = {
1383 &op_timeout_secs_attribute
.attr
,
1384 &slot_timeout_secs_attribute
.attr
,
1385 &perf_counter_reset_attribute
.attr
,
1386 &perf_history_size_attribute
.attr
,
1387 &perf_time_interval_secs_attribute
.attr
,
1391 static struct kobj_type orangefs_ktype
= {
1392 .sysfs_ops
= &orangefs_sysfs_ops
,
1393 .release
= orangefs_release
,
1394 .default_attrs
= orangefs_default_attrs
,
1397 static struct acache_orangefs_attribute acache_hard_limit_attribute
=
1400 service_acache_show
,
1401 service_acache_store
);
1403 static struct acache_orangefs_attribute acache_reclaim_percent_attribute
=
1404 __ATTR(reclaim_percentage
,
1406 service_acache_show
,
1407 service_acache_store
);
1409 static struct acache_orangefs_attribute acache_soft_limit_attribute
=
1412 service_acache_show
,
1413 service_acache_store
);
1415 static struct acache_orangefs_attribute acache_timeout_msecs_attribute
=
1416 __ATTR(timeout_msecs
,
1418 service_acache_show
,
1419 service_acache_store
);
1421 static struct attribute
*acache_orangefs_default_attrs
[] = {
1422 &acache_hard_limit_attribute
.attr
,
1423 &acache_reclaim_percent_attribute
.attr
,
1424 &acache_soft_limit_attribute
.attr
,
1425 &acache_timeout_msecs_attribute
.attr
,
1429 static struct kobj_type acache_orangefs_ktype
= {
1430 .sysfs_ops
= &acache_orangefs_sysfs_ops
,
1431 .release
= acache_orangefs_release
,
1432 .default_attrs
= acache_orangefs_default_attrs
,
1435 static struct capcache_orangefs_attribute capcache_hard_limit_attribute
=
1438 service_capcache_show
,
1439 service_capcache_store
);
1441 static struct capcache_orangefs_attribute capcache_reclaim_percent_attribute
=
1442 __ATTR(reclaim_percentage
,
1444 service_capcache_show
,
1445 service_capcache_store
);
1447 static struct capcache_orangefs_attribute capcache_soft_limit_attribute
=
1450 service_capcache_show
,
1451 service_capcache_store
);
1453 static struct capcache_orangefs_attribute capcache_timeout_secs_attribute
=
1454 __ATTR(timeout_secs
,
1456 service_capcache_show
,
1457 service_capcache_store
);
1459 static struct attribute
*capcache_orangefs_default_attrs
[] = {
1460 &capcache_hard_limit_attribute
.attr
,
1461 &capcache_reclaim_percent_attribute
.attr
,
1462 &capcache_soft_limit_attribute
.attr
,
1463 &capcache_timeout_secs_attribute
.attr
,
1467 static struct kobj_type capcache_orangefs_ktype
= {
1468 .sysfs_ops
= &capcache_orangefs_sysfs_ops
,
1469 .release
= capcache_orangefs_release
,
1470 .default_attrs
= capcache_orangefs_default_attrs
,
1473 static struct ccache_orangefs_attribute ccache_hard_limit_attribute
=
1476 service_ccache_show
,
1477 service_ccache_store
);
1479 static struct ccache_orangefs_attribute ccache_reclaim_percent_attribute
=
1480 __ATTR(reclaim_percentage
,
1482 service_ccache_show
,
1483 service_ccache_store
);
1485 static struct ccache_orangefs_attribute ccache_soft_limit_attribute
=
1488 service_ccache_show
,
1489 service_ccache_store
);
1491 static struct ccache_orangefs_attribute ccache_timeout_secs_attribute
=
1492 __ATTR(timeout_secs
,
1494 service_ccache_show
,
1495 service_ccache_store
);
1497 static struct attribute
*ccache_orangefs_default_attrs
[] = {
1498 &ccache_hard_limit_attribute
.attr
,
1499 &ccache_reclaim_percent_attribute
.attr
,
1500 &ccache_soft_limit_attribute
.attr
,
1501 &ccache_timeout_secs_attribute
.attr
,
1505 static struct kobj_type ccache_orangefs_ktype
= {
1506 .sysfs_ops
= &ccache_orangefs_sysfs_ops
,
1507 .release
= ccache_orangefs_release
,
1508 .default_attrs
= ccache_orangefs_default_attrs
,
1511 static struct ncache_orangefs_attribute ncache_hard_limit_attribute
=
1514 service_ncache_show
,
1515 service_ncache_store
);
1517 static struct ncache_orangefs_attribute ncache_reclaim_percent_attribute
=
1518 __ATTR(reclaim_percentage
,
1520 service_ncache_show
,
1521 service_ncache_store
);
1523 static struct ncache_orangefs_attribute ncache_soft_limit_attribute
=
1526 service_ncache_show
,
1527 service_ncache_store
);
1529 static struct ncache_orangefs_attribute ncache_timeout_msecs_attribute
=
1530 __ATTR(timeout_msecs
,
1532 service_ncache_show
,
1533 service_ncache_store
);
1535 static struct attribute
*ncache_orangefs_default_attrs
[] = {
1536 &ncache_hard_limit_attribute
.attr
,
1537 &ncache_reclaim_percent_attribute
.attr
,
1538 &ncache_soft_limit_attribute
.attr
,
1539 &ncache_timeout_msecs_attribute
.attr
,
1543 static struct kobj_type ncache_orangefs_ktype
= {
1544 .sysfs_ops
= &ncache_orangefs_sysfs_ops
,
1545 .release
= ncache_orangefs_release
,
1546 .default_attrs
= ncache_orangefs_default_attrs
,
1549 static struct pc_orangefs_attribute pc_acache_attribute
=
1555 static struct pc_orangefs_attribute pc_capcache_attribute
=
1561 static struct pc_orangefs_attribute pc_ncache_attribute
=
1567 static struct attribute
*pc_orangefs_default_attrs
[] = {
1568 &pc_acache_attribute
.attr
,
1569 &pc_capcache_attribute
.attr
,
1570 &pc_ncache_attribute
.attr
,
1574 static struct kobj_type pc_orangefs_ktype
= {
1575 .sysfs_ops
= &pc_orangefs_sysfs_ops
,
1576 .release
= pc_orangefs_release
,
1577 .default_attrs
= pc_orangefs_default_attrs
,
1580 static struct stats_orangefs_attribute stats_reads_attribute
=
1586 static struct stats_orangefs_attribute stats_writes_attribute
=
1592 static struct attribute
*stats_orangefs_default_attrs
[] = {
1593 &stats_reads_attribute
.attr
,
1594 &stats_writes_attribute
.attr
,
1598 static struct kobj_type stats_orangefs_ktype
= {
1599 .sysfs_ops
= &stats_orangefs_sysfs_ops
,
1600 .release
= stats_orangefs_release
,
1601 .default_attrs
= stats_orangefs_default_attrs
,
1604 static struct orangefs_obj
*orangefs_obj
;
1605 static struct acache_orangefs_obj
*acache_orangefs_obj
;
1606 static struct capcache_orangefs_obj
*capcache_orangefs_obj
;
1607 static struct ccache_orangefs_obj
*ccache_orangefs_obj
;
1608 static struct ncache_orangefs_obj
*ncache_orangefs_obj
;
1609 static struct pc_orangefs_obj
*pc_orangefs_obj
;
1610 static struct stats_orangefs_obj
*stats_orangefs_obj
;
1612 int orangefs_sysfs_init(void)
1616 gossip_debug(GOSSIP_SYSFS_DEBUG
, "orangefs_sysfs_init: start\n");
1618 /* create /sys/fs/orangefs. */
1619 orangefs_obj
= kzalloc(sizeof(*orangefs_obj
), GFP_KERNEL
);
1623 rc
= kobject_init_and_add(&orangefs_obj
->kobj
,
1631 kobject_uevent(&orangefs_obj
->kobj
, KOBJ_ADD
);
1633 /* create /sys/fs/orangefs/acache. */
1634 acache_orangefs_obj
= kzalloc(sizeof(*acache_orangefs_obj
), GFP_KERNEL
);
1635 if (!acache_orangefs_obj
) {
1640 rc
= kobject_init_and_add(&acache_orangefs_obj
->kobj
,
1641 &acache_orangefs_ktype
,
1642 &orangefs_obj
->kobj
,
1646 goto acache_obj_bail
;
1648 kobject_uevent(&acache_orangefs_obj
->kobj
, KOBJ_ADD
);
1650 /* create /sys/fs/orangefs/capcache. */
1651 capcache_orangefs_obj
=
1652 kzalloc(sizeof(*capcache_orangefs_obj
), GFP_KERNEL
);
1653 if (!capcache_orangefs_obj
) {
1655 goto acache_obj_bail
;
1658 rc
= kobject_init_and_add(&capcache_orangefs_obj
->kobj
,
1659 &capcache_orangefs_ktype
,
1660 &orangefs_obj
->kobj
,
1663 goto capcache_obj_bail
;
1665 kobject_uevent(&capcache_orangefs_obj
->kobj
, KOBJ_ADD
);
1667 /* create /sys/fs/orangefs/ccache. */
1668 ccache_orangefs_obj
=
1669 kzalloc(sizeof(*ccache_orangefs_obj
), GFP_KERNEL
);
1670 if (!ccache_orangefs_obj
) {
1672 goto capcache_obj_bail
;
1675 rc
= kobject_init_and_add(&ccache_orangefs_obj
->kobj
,
1676 &ccache_orangefs_ktype
,
1677 &orangefs_obj
->kobj
,
1680 goto ccache_obj_bail
;
1682 kobject_uevent(&ccache_orangefs_obj
->kobj
, KOBJ_ADD
);
1684 /* create /sys/fs/orangefs/ncache. */
1685 ncache_orangefs_obj
= kzalloc(sizeof(*ncache_orangefs_obj
), GFP_KERNEL
);
1686 if (!ncache_orangefs_obj
) {
1688 goto ccache_obj_bail
;
1691 rc
= kobject_init_and_add(&ncache_orangefs_obj
->kobj
,
1692 &ncache_orangefs_ktype
,
1693 &orangefs_obj
->kobj
,
1697 goto ncache_obj_bail
;
1699 kobject_uevent(&ncache_orangefs_obj
->kobj
, KOBJ_ADD
);
1701 /* create /sys/fs/orangefs/perf_counters. */
1702 pc_orangefs_obj
= kzalloc(sizeof(*pc_orangefs_obj
), GFP_KERNEL
);
1703 if (!pc_orangefs_obj
) {
1705 goto ncache_obj_bail
;
1708 rc
= kobject_init_and_add(&pc_orangefs_obj
->kobj
,
1710 &orangefs_obj
->kobj
,
1716 kobject_uevent(&pc_orangefs_obj
->kobj
, KOBJ_ADD
);
1718 /* create /sys/fs/orangefs/stats. */
1719 stats_orangefs_obj
= kzalloc(sizeof(*stats_orangefs_obj
), GFP_KERNEL
);
1720 if (!stats_orangefs_obj
) {
1725 rc
= kobject_init_and_add(&stats_orangefs_obj
->kobj
,
1726 &stats_orangefs_ktype
,
1727 &orangefs_obj
->kobj
,
1731 goto stats_obj_bail
;
1733 kobject_uevent(&stats_orangefs_obj
->kobj
, KOBJ_ADD
);
1737 kobject_put(&stats_orangefs_obj
->kobj
);
1740 kobject_put(&pc_orangefs_obj
->kobj
);
1743 kobject_put(&ncache_orangefs_obj
->kobj
);
1746 kobject_put(&ccache_orangefs_obj
->kobj
);
1749 kobject_put(&capcache_orangefs_obj
->kobj
);
1752 kobject_put(&acache_orangefs_obj
->kobj
);
1755 kobject_put(&orangefs_obj
->kobj
);
1760 void orangefs_sysfs_exit(void)
1762 gossip_debug(GOSSIP_SYSFS_DEBUG
, "orangefs_sysfs_exit: start\n");
1764 kobject_put(&acache_orangefs_obj
->kobj
);
1765 kobject_put(&capcache_orangefs_obj
->kobj
);
1766 kobject_put(&ccache_orangefs_obj
->kobj
);
1767 kobject_put(&ncache_orangefs_obj
->kobj
);
1768 kobject_put(&pc_orangefs_obj
->kobj
);
1769 kobject_put(&stats_orangefs_obj
->kobj
);
1771 kobject_put(&orangefs_obj
->kobj
);