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/acache/...
78 * Contact: Martin Brandenburg <martin@omnibond.com>
80 * Attribute cache configurable settings.
83 * What: /sys/fs/orangefs/ncache/...
85 * Contact: Mike Marshall <hubcap@omnibond.com>
87 * Name cache configurable settings.
90 * What: /sys/fs/orangefs/capcache/...
92 * Contact: Mike Marshall <hubcap@omnibond.com>
94 * Capability cache configurable settings.
97 * What: /sys/fs/orangefs/ccache/...
99 * Contact: Mike Marshall <hubcap@omnibond.com>
101 * Credential cache configurable settings.
105 #include <linux/fs.h>
106 #include <linux/kobject.h>
107 #include <linux/string.h>
108 #include <linux/sysfs.h>
109 #include <linux/module.h>
110 #include <linux/init.h>
112 #include "protocol.h"
113 #include "orangefs-kernel.h"
114 #include "orangefs-sysfs.h"
116 #define ORANGEFS_KOBJ_ID "orangefs"
117 #define ACACHE_KOBJ_ID "acache"
118 #define CAPCACHE_KOBJ_ID "capcache"
119 #define CCACHE_KOBJ_ID "ccache"
120 #define NCACHE_KOBJ_ID "ncache"
121 #define PC_KOBJ_ID "pc"
122 #define STATS_KOBJ_ID "stats"
124 struct orangefs_obj
{
127 int perf_counter_reset
;
128 int perf_history_size
;
129 int perf_time_interval_secs
;
130 int slot_timeout_secs
;
131 int dcache_timeout_msecs
;
132 int getattr_timeout_msecs
;
135 struct acache_orangefs_obj
{
138 int reclaim_percentage
;
143 struct capcache_orangefs_obj
{
146 int reclaim_percentage
;
151 struct ccache_orangefs_obj
{
154 int reclaim_percentage
;
159 struct ncache_orangefs_obj
{
162 int reclaim_percentage
;
167 struct pc_orangefs_obj
{
174 struct stats_orangefs_obj
{
180 struct orangefs_attribute
{
181 struct attribute attr
;
182 ssize_t (*show
)(struct orangefs_obj
*orangefs_obj
,
183 struct orangefs_attribute
*attr
,
185 ssize_t (*store
)(struct orangefs_obj
*orangefs_obj
,
186 struct orangefs_attribute
*attr
,
191 struct acache_orangefs_attribute
{
192 struct attribute attr
;
193 ssize_t (*show
)(struct acache_orangefs_obj
*acache_orangefs_obj
,
194 struct acache_orangefs_attribute
*attr
,
196 ssize_t (*store
)(struct acache_orangefs_obj
*acache_orangefs_obj
,
197 struct acache_orangefs_attribute
*attr
,
202 struct capcache_orangefs_attribute
{
203 struct attribute attr
;
204 ssize_t (*show
)(struct capcache_orangefs_obj
*capcache_orangefs_obj
,
205 struct capcache_orangefs_attribute
*attr
,
207 ssize_t (*store
)(struct capcache_orangefs_obj
*capcache_orangefs_obj
,
208 struct capcache_orangefs_attribute
*attr
,
213 struct ccache_orangefs_attribute
{
214 struct attribute attr
;
215 ssize_t (*show
)(struct ccache_orangefs_obj
*ccache_orangefs_obj
,
216 struct ccache_orangefs_attribute
*attr
,
218 ssize_t (*store
)(struct ccache_orangefs_obj
*ccache_orangefs_obj
,
219 struct ccache_orangefs_attribute
*attr
,
224 struct ncache_orangefs_attribute
{
225 struct attribute attr
;
226 ssize_t (*show
)(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
227 struct ncache_orangefs_attribute
*attr
,
229 ssize_t (*store
)(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
230 struct ncache_orangefs_attribute
*attr
,
235 struct pc_orangefs_attribute
{
236 struct attribute attr
;
237 ssize_t (*show
)(struct pc_orangefs_obj
*pc_orangefs_obj
,
238 struct pc_orangefs_attribute
*attr
,
240 ssize_t (*store
)(struct pc_orangefs_obj
*pc_orangefs_obj
,
241 struct pc_orangefs_attribute
*attr
,
246 struct stats_orangefs_attribute
{
247 struct attribute attr
;
248 ssize_t (*show
)(struct stats_orangefs_obj
*stats_orangefs_obj
,
249 struct stats_orangefs_attribute
*attr
,
251 ssize_t (*store
)(struct stats_orangefs_obj
*stats_orangefs_obj
,
252 struct stats_orangefs_attribute
*attr
,
257 static ssize_t
orangefs_attr_show(struct kobject
*kobj
,
258 struct attribute
*attr
,
261 struct orangefs_attribute
*attribute
;
262 struct orangefs_obj
*orangefs_obj
;
265 attribute
= container_of(attr
, struct orangefs_attribute
, attr
);
266 orangefs_obj
= container_of(kobj
, struct orangefs_obj
, kobj
);
268 if (!attribute
->show
) {
273 rc
= attribute
->show(orangefs_obj
, attribute
, buf
);
279 static ssize_t
orangefs_attr_store(struct kobject
*kobj
,
280 struct attribute
*attr
,
284 struct orangefs_attribute
*attribute
;
285 struct orangefs_obj
*orangefs_obj
;
288 gossip_debug(GOSSIP_SYSFS_DEBUG
,
289 "orangefs_attr_store: start\n");
291 attribute
= container_of(attr
, struct orangefs_attribute
, attr
);
292 orangefs_obj
= container_of(kobj
, struct orangefs_obj
, kobj
);
294 if (!attribute
->store
) {
299 rc
= attribute
->store(orangefs_obj
, attribute
, buf
, len
);
305 static const struct sysfs_ops orangefs_sysfs_ops
= {
306 .show
= orangefs_attr_show
,
307 .store
= orangefs_attr_store
,
310 static ssize_t
acache_orangefs_attr_show(struct kobject
*kobj
,
311 struct attribute
*attr
,
314 struct acache_orangefs_attribute
*attribute
;
315 struct acache_orangefs_obj
*acache_orangefs_obj
;
318 attribute
= container_of(attr
, struct acache_orangefs_attribute
, attr
);
319 acache_orangefs_obj
=
320 container_of(kobj
, struct acache_orangefs_obj
, kobj
);
322 if (!attribute
->show
) {
327 rc
= attribute
->show(acache_orangefs_obj
, attribute
, buf
);
333 static ssize_t
acache_orangefs_attr_store(struct kobject
*kobj
,
334 struct attribute
*attr
,
338 struct acache_orangefs_attribute
*attribute
;
339 struct acache_orangefs_obj
*acache_orangefs_obj
;
342 gossip_debug(GOSSIP_SYSFS_DEBUG
,
343 "acache_orangefs_attr_store: start\n");
345 attribute
= container_of(attr
, struct acache_orangefs_attribute
, attr
);
346 acache_orangefs_obj
=
347 container_of(kobj
, struct acache_orangefs_obj
, kobj
);
349 if (!attribute
->store
) {
354 rc
= attribute
->store(acache_orangefs_obj
, attribute
, buf
, len
);
360 static const struct sysfs_ops acache_orangefs_sysfs_ops
= {
361 .show
= acache_orangefs_attr_show
,
362 .store
= acache_orangefs_attr_store
,
365 static ssize_t
capcache_orangefs_attr_show(struct kobject
*kobj
,
366 struct attribute
*attr
,
369 struct capcache_orangefs_attribute
*attribute
;
370 struct capcache_orangefs_obj
*capcache_orangefs_obj
;
374 container_of(attr
, struct capcache_orangefs_attribute
, attr
);
375 capcache_orangefs_obj
=
376 container_of(kobj
, struct capcache_orangefs_obj
, kobj
);
378 if (!attribute
->show
) {
383 rc
= attribute
->show(capcache_orangefs_obj
, attribute
, buf
);
389 static ssize_t
capcache_orangefs_attr_store(struct kobject
*kobj
,
390 struct attribute
*attr
,
394 struct capcache_orangefs_attribute
*attribute
;
395 struct capcache_orangefs_obj
*capcache_orangefs_obj
;
398 gossip_debug(GOSSIP_SYSFS_DEBUG
,
399 "capcache_orangefs_attr_store: start\n");
402 container_of(attr
, struct capcache_orangefs_attribute
, attr
);
403 capcache_orangefs_obj
=
404 container_of(kobj
, struct capcache_orangefs_obj
, kobj
);
406 if (!attribute
->store
) {
411 rc
= attribute
->store(capcache_orangefs_obj
, attribute
, buf
, len
);
417 static const struct sysfs_ops capcache_orangefs_sysfs_ops
= {
418 .show
= capcache_orangefs_attr_show
,
419 .store
= capcache_orangefs_attr_store
,
422 static ssize_t
ccache_orangefs_attr_show(struct kobject
*kobj
,
423 struct attribute
*attr
,
426 struct ccache_orangefs_attribute
*attribute
;
427 struct ccache_orangefs_obj
*ccache_orangefs_obj
;
431 container_of(attr
, struct ccache_orangefs_attribute
, attr
);
432 ccache_orangefs_obj
=
433 container_of(kobj
, struct ccache_orangefs_obj
, kobj
);
435 if (!attribute
->show
) {
440 rc
= attribute
->show(ccache_orangefs_obj
, attribute
, buf
);
446 static ssize_t
ccache_orangefs_attr_store(struct kobject
*kobj
,
447 struct attribute
*attr
,
451 struct ccache_orangefs_attribute
*attribute
;
452 struct ccache_orangefs_obj
*ccache_orangefs_obj
;
455 gossip_debug(GOSSIP_SYSFS_DEBUG
,
456 "ccache_orangefs_attr_store: start\n");
459 container_of(attr
, struct ccache_orangefs_attribute
, attr
);
460 ccache_orangefs_obj
=
461 container_of(kobj
, struct ccache_orangefs_obj
, kobj
);
463 if (!attribute
->store
) {
468 rc
= attribute
->store(ccache_orangefs_obj
, attribute
, buf
, len
);
474 static const struct sysfs_ops ccache_orangefs_sysfs_ops
= {
475 .show
= ccache_orangefs_attr_show
,
476 .store
= ccache_orangefs_attr_store
,
479 static ssize_t
ncache_orangefs_attr_show(struct kobject
*kobj
,
480 struct attribute
*attr
,
483 struct ncache_orangefs_attribute
*attribute
;
484 struct ncache_orangefs_obj
*ncache_orangefs_obj
;
487 attribute
= container_of(attr
, struct ncache_orangefs_attribute
, attr
);
488 ncache_orangefs_obj
=
489 container_of(kobj
, struct ncache_orangefs_obj
, kobj
);
491 if (!attribute
->show
) {
496 rc
= attribute
->show(ncache_orangefs_obj
, attribute
, buf
);
502 static ssize_t
ncache_orangefs_attr_store(struct kobject
*kobj
,
503 struct attribute
*attr
,
507 struct ncache_orangefs_attribute
*attribute
;
508 struct ncache_orangefs_obj
*ncache_orangefs_obj
;
511 gossip_debug(GOSSIP_SYSFS_DEBUG
,
512 "ncache_orangefs_attr_store: start\n");
514 attribute
= container_of(attr
, struct ncache_orangefs_attribute
, attr
);
515 ncache_orangefs_obj
=
516 container_of(kobj
, struct ncache_orangefs_obj
, kobj
);
518 if (!attribute
->store
) {
523 rc
= attribute
->store(ncache_orangefs_obj
, attribute
, buf
, len
);
529 static const struct sysfs_ops ncache_orangefs_sysfs_ops
= {
530 .show
= ncache_orangefs_attr_show
,
531 .store
= ncache_orangefs_attr_store
,
534 static ssize_t
pc_orangefs_attr_show(struct kobject
*kobj
,
535 struct attribute
*attr
,
538 struct pc_orangefs_attribute
*attribute
;
539 struct pc_orangefs_obj
*pc_orangefs_obj
;
542 attribute
= container_of(attr
, struct pc_orangefs_attribute
, attr
);
544 container_of(kobj
, struct pc_orangefs_obj
, kobj
);
546 if (!attribute
->show
) {
551 rc
= attribute
->show(pc_orangefs_obj
, attribute
, buf
);
557 static const struct sysfs_ops pc_orangefs_sysfs_ops
= {
558 .show
= pc_orangefs_attr_show
,
561 static ssize_t
stats_orangefs_attr_show(struct kobject
*kobj
,
562 struct attribute
*attr
,
565 struct stats_orangefs_attribute
*attribute
;
566 struct stats_orangefs_obj
*stats_orangefs_obj
;
569 attribute
= container_of(attr
, struct stats_orangefs_attribute
, attr
);
571 container_of(kobj
, struct stats_orangefs_obj
, kobj
);
573 if (!attribute
->show
) {
578 rc
= attribute
->show(stats_orangefs_obj
, attribute
, buf
);
584 static const struct sysfs_ops stats_orangefs_sysfs_ops
= {
585 .show
= stats_orangefs_attr_show
,
588 static void orangefs_release(struct kobject
*kobj
)
590 struct orangefs_obj
*orangefs_obj
;
592 orangefs_obj
= container_of(kobj
, struct orangefs_obj
, kobj
);
596 static void acache_orangefs_release(struct kobject
*kobj
)
598 struct acache_orangefs_obj
*acache_orangefs_obj
;
600 acache_orangefs_obj
=
601 container_of(kobj
, struct acache_orangefs_obj
, kobj
);
602 kfree(acache_orangefs_obj
);
605 static void capcache_orangefs_release(struct kobject
*kobj
)
607 struct capcache_orangefs_obj
*capcache_orangefs_obj
;
609 capcache_orangefs_obj
=
610 container_of(kobj
, struct capcache_orangefs_obj
, kobj
);
611 kfree(capcache_orangefs_obj
);
614 static void ccache_orangefs_release(struct kobject
*kobj
)
616 struct ccache_orangefs_obj
*ccache_orangefs_obj
;
618 ccache_orangefs_obj
=
619 container_of(kobj
, struct ccache_orangefs_obj
, kobj
);
620 kfree(ccache_orangefs_obj
);
623 static void ncache_orangefs_release(struct kobject
*kobj
)
625 struct ncache_orangefs_obj
*ncache_orangefs_obj
;
627 ncache_orangefs_obj
=
628 container_of(kobj
, struct ncache_orangefs_obj
, kobj
);
629 kfree(ncache_orangefs_obj
);
632 static void pc_orangefs_release(struct kobject
*kobj
)
634 struct pc_orangefs_obj
*pc_orangefs_obj
;
637 container_of(kobj
, struct pc_orangefs_obj
, kobj
);
638 kfree(pc_orangefs_obj
);
641 static void stats_orangefs_release(struct kobject
*kobj
)
643 struct stats_orangefs_obj
*stats_orangefs_obj
;
646 container_of(kobj
, struct stats_orangefs_obj
, kobj
);
647 kfree(stats_orangefs_obj
);
650 static ssize_t
sysfs_int_show(char *kobj_id
, char *buf
, void *attr
)
653 struct orangefs_attribute
*orangefs_attr
;
654 struct stats_orangefs_attribute
*stats_orangefs_attr
;
656 gossip_debug(GOSSIP_SYSFS_DEBUG
, "sysfs_int_show: id:%s:\n", kobj_id
);
658 if (!strcmp(kobj_id
, ORANGEFS_KOBJ_ID
)) {
659 orangefs_attr
= (struct orangefs_attribute
*)attr
;
661 if (!strcmp(orangefs_attr
->attr
.name
, "op_timeout_secs")) {
667 } else if (!strcmp(orangefs_attr
->attr
.name
,
668 "slot_timeout_secs")) {
674 } else if (!strcmp(orangefs_attr
->attr
.name
,
675 "dcache_timeout_msecs")) {
679 dcache_timeout_msecs
);
681 } else if (!strcmp(orangefs_attr
->attr
.name
,
682 "getattr_timeout_msecs")) {
686 getattr_timeout_msecs
);
692 } else if (!strcmp(kobj_id
, STATS_KOBJ_ID
)) {
693 stats_orangefs_attr
= (struct stats_orangefs_attribute
*)attr
;
695 if (!strcmp(stats_orangefs_attr
->attr
.name
, "reads")) {
699 g_orangefs_stats
.reads
);
701 } else if (!strcmp(stats_orangefs_attr
->attr
.name
, "writes")) {
705 g_orangefs_stats
.writes
);
717 static ssize_t
int_orangefs_show(struct orangefs_obj
*orangefs_obj
,
718 struct orangefs_attribute
*attr
,
723 gossip_debug(GOSSIP_SYSFS_DEBUG
,
724 "int_orangefs_show:start attr->attr.name:%s:\n",
727 rc
= sysfs_int_show(ORANGEFS_KOBJ_ID
, buf
, (void *) attr
);
732 static ssize_t
int_stats_show(struct stats_orangefs_obj
*stats_orangefs_obj
,
733 struct stats_orangefs_attribute
*attr
,
738 gossip_debug(GOSSIP_SYSFS_DEBUG
,
739 "int_stats_show:start attr->attr.name:%s:\n",
742 rc
= sysfs_int_show(STATS_KOBJ_ID
, buf
, (void *) attr
);
747 static ssize_t
int_store(struct orangefs_obj
*orangefs_obj
,
748 struct orangefs_attribute
*attr
,
754 gossip_debug(GOSSIP_SYSFS_DEBUG
,
755 "int_store: start attr->attr.name:%s: buf:%s:\n",
756 attr
->attr
.name
, buf
);
758 if (!strcmp(attr
->attr
.name
, "op_timeout_secs")) {
759 rc
= kstrtoint(buf
, 0, &op_timeout_secs
);
761 } else if (!strcmp(attr
->attr
.name
, "slot_timeout_secs")) {
762 rc
= kstrtoint(buf
, 0, &slot_timeout_secs
);
764 } else if (!strcmp(attr
->attr
.name
, "dcache_timeout_msecs")) {
765 rc
= kstrtoint(buf
, 0, &dcache_timeout_msecs
);
767 } else if (!strcmp(attr
->attr
.name
, "getattr_timeout_msecs")) {
768 rc
= kstrtoint(buf
, 0, &getattr_timeout_msecs
);
784 * obtain attribute values from userspace with a service operation.
786 static int sysfs_service_op_show(char *kobj_id
, char *buf
, void *attr
)
788 struct orangefs_kernel_op_s
*new_op
= NULL
;
790 char *ser_op_type
= NULL
;
791 struct orangefs_attribute
*orangefs_attr
;
792 struct acache_orangefs_attribute
*acache_attr
;
793 struct capcache_orangefs_attribute
*capcache_attr
;
794 struct ccache_orangefs_attribute
*ccache_attr
;
795 struct ncache_orangefs_attribute
*ncache_attr
;
796 struct pc_orangefs_attribute
*pc_attr
;
799 gossip_debug(GOSSIP_SYSFS_DEBUG
,
800 "sysfs_service_op_show: id:%s:\n",
803 if (strcmp(kobj_id
, PC_KOBJ_ID
))
804 op_alloc_type
= ORANGEFS_VFS_OP_PARAM
;
806 op_alloc_type
= ORANGEFS_VFS_OP_PERF_COUNT
;
808 new_op
= op_alloc(op_alloc_type
);
812 /* Can't do a service_operation if the client is not running... */
813 rc
= is_daemon_in_service();
815 pr_info("%s: Client not running :%d:\n",
817 is_daemon_in_service());
821 if (strcmp(kobj_id
, PC_KOBJ_ID
))
822 new_op
->upcall
.req
.param
.type
= ORANGEFS_PARAM_REQUEST_GET
;
824 if (!strcmp(kobj_id
, ORANGEFS_KOBJ_ID
)) {
825 orangefs_attr
= (struct orangefs_attribute
*)attr
;
827 if (!strcmp(orangefs_attr
->attr
.name
, "perf_history_size"))
828 new_op
->upcall
.req
.param
.op
=
829 ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE
;
830 else if (!strcmp(orangefs_attr
->attr
.name
,
831 "perf_time_interval_secs"))
832 new_op
->upcall
.req
.param
.op
=
833 ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS
;
834 else if (!strcmp(orangefs_attr
->attr
.name
,
835 "perf_counter_reset"))
836 new_op
->upcall
.req
.param
.op
=
837 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET
;
839 } else if (!strcmp(kobj_id
, ACACHE_KOBJ_ID
)) {
840 acache_attr
= (struct acache_orangefs_attribute
*)attr
;
842 if (!strcmp(acache_attr
->attr
.name
, "timeout_msecs"))
843 new_op
->upcall
.req
.param
.op
=
844 ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS
;
846 if (!strcmp(acache_attr
->attr
.name
, "hard_limit"))
847 new_op
->upcall
.req
.param
.op
=
848 ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT
;
850 if (!strcmp(acache_attr
->attr
.name
, "soft_limit"))
851 new_op
->upcall
.req
.param
.op
=
852 ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT
;
854 if (!strcmp(acache_attr
->attr
.name
, "reclaim_percentage"))
855 new_op
->upcall
.req
.param
.op
=
856 ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE
;
858 } else if (!strcmp(kobj_id
, CAPCACHE_KOBJ_ID
)) {
859 capcache_attr
= (struct capcache_orangefs_attribute
*)attr
;
861 if (!strcmp(capcache_attr
->attr
.name
, "timeout_secs"))
862 new_op
->upcall
.req
.param
.op
=
863 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS
;
865 if (!strcmp(capcache_attr
->attr
.name
, "hard_limit"))
866 new_op
->upcall
.req
.param
.op
=
867 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT
;
869 if (!strcmp(capcache_attr
->attr
.name
, "soft_limit"))
870 new_op
->upcall
.req
.param
.op
=
871 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT
;
873 if (!strcmp(capcache_attr
->attr
.name
, "reclaim_percentage"))
874 new_op
->upcall
.req
.param
.op
=
875 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE
;
877 } else if (!strcmp(kobj_id
, CCACHE_KOBJ_ID
)) {
878 ccache_attr
= (struct ccache_orangefs_attribute
*)attr
;
880 if (!strcmp(ccache_attr
->attr
.name
, "timeout_secs"))
881 new_op
->upcall
.req
.param
.op
=
882 ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS
;
884 if (!strcmp(ccache_attr
->attr
.name
, "hard_limit"))
885 new_op
->upcall
.req
.param
.op
=
886 ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT
;
888 if (!strcmp(ccache_attr
->attr
.name
, "soft_limit"))
889 new_op
->upcall
.req
.param
.op
=
890 ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT
;
892 if (!strcmp(ccache_attr
->attr
.name
, "reclaim_percentage"))
893 new_op
->upcall
.req
.param
.op
=
894 ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE
;
896 } else if (!strcmp(kobj_id
, NCACHE_KOBJ_ID
)) {
897 ncache_attr
= (struct ncache_orangefs_attribute
*)attr
;
899 if (!strcmp(ncache_attr
->attr
.name
, "timeout_msecs"))
900 new_op
->upcall
.req
.param
.op
=
901 ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS
;
903 if (!strcmp(ncache_attr
->attr
.name
, "hard_limit"))
904 new_op
->upcall
.req
.param
.op
=
905 ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT
;
907 if (!strcmp(ncache_attr
->attr
.name
, "soft_limit"))
908 new_op
->upcall
.req
.param
.op
=
909 ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT
;
911 if (!strcmp(ncache_attr
->attr
.name
, "reclaim_percentage"))
912 new_op
->upcall
.req
.param
.op
=
913 ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE
;
915 } else if (!strcmp(kobj_id
, PC_KOBJ_ID
)) {
916 pc_attr
= (struct pc_orangefs_attribute
*)attr
;
918 if (!strcmp(pc_attr
->attr
.name
, ACACHE_KOBJ_ID
))
919 new_op
->upcall
.req
.perf_count
.type
=
920 ORANGEFS_PERF_COUNT_REQUEST_ACACHE
;
922 if (!strcmp(pc_attr
->attr
.name
, CAPCACHE_KOBJ_ID
))
923 new_op
->upcall
.req
.perf_count
.type
=
924 ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE
;
926 if (!strcmp(pc_attr
->attr
.name
, NCACHE_KOBJ_ID
))
927 new_op
->upcall
.req
.perf_count
.type
=
928 ORANGEFS_PERF_COUNT_REQUEST_NCACHE
;
931 gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n",
938 if (strcmp(kobj_id
, PC_KOBJ_ID
))
939 ser_op_type
= "orangefs_param";
941 ser_op_type
= "orangefs_perf_count";
944 * The service_operation will return an errno return code on
945 * error, and zero on success.
947 rc
= service_operation(new_op
, ser_op_type
, ORANGEFS_OP_INTERRUPTIBLE
);
951 if (strcmp(kobj_id
, PC_KOBJ_ID
)) {
955 (int)new_op
->downcall
.resp
.param
.value
);
961 new_op
->downcall
.resp
.perf_count
.buffer
);
971 static ssize_t
service_orangefs_show(struct orangefs_obj
*orangefs_obj
,
972 struct orangefs_attribute
*attr
,
977 rc
= sysfs_service_op_show(ORANGEFS_KOBJ_ID
, buf
, (void *)attr
);
983 service_acache_show(struct acache_orangefs_obj
*acache_orangefs_obj
,
984 struct acache_orangefs_attribute
*attr
,
989 rc
= sysfs_service_op_show(ACACHE_KOBJ_ID
, buf
, (void *)attr
);
994 static ssize_t
service_capcache_show(struct capcache_orangefs_obj
995 *capcache_orangefs_obj
,
996 struct capcache_orangefs_attribute
*attr
,
1001 rc
= sysfs_service_op_show(CAPCACHE_KOBJ_ID
, buf
, (void *)attr
);
1006 static ssize_t
service_ccache_show(struct ccache_orangefs_obj
1007 *ccache_orangefs_obj
,
1008 struct ccache_orangefs_attribute
*attr
,
1013 rc
= sysfs_service_op_show(CCACHE_KOBJ_ID
, buf
, (void *)attr
);
1019 service_ncache_show(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
1020 struct ncache_orangefs_attribute
*attr
,
1025 rc
= sysfs_service_op_show(NCACHE_KOBJ_ID
, buf
, (void *)attr
);
1031 service_pc_show(struct pc_orangefs_obj
*pc_orangefs_obj
,
1032 struct pc_orangefs_attribute
*attr
,
1037 rc
= sysfs_service_op_show(PC_KOBJ_ID
, buf
, (void *)attr
);
1043 * pass attribute values back to userspace with a service operation.
1045 * We have to do a memory allocation, an sscanf and a service operation.
1046 * And we have to evaluate what the user entered, to make sure the
1047 * value is within the range supported by the attribute. So, there's
1048 * a lot of return code checking and mapping going on here.
1050 * We want to return 1 if we think everything went OK, and
1053 static int sysfs_service_op_store(char *kobj_id
, const char *buf
, void *attr
)
1055 struct orangefs_kernel_op_s
*new_op
= NULL
;
1058 struct orangefs_attribute
*orangefs_attr
;
1059 struct acache_orangefs_attribute
*acache_attr
;
1060 struct capcache_orangefs_attribute
*capcache_attr
;
1061 struct ccache_orangefs_attribute
*ccache_attr
;
1062 struct ncache_orangefs_attribute
*ncache_attr
;
1064 gossip_debug(GOSSIP_SYSFS_DEBUG
,
1065 "sysfs_service_op_store: id:%s:\n",
1068 new_op
= op_alloc(ORANGEFS_VFS_OP_PARAM
);
1070 return -EINVAL
; /* sic */
1072 /* Can't do a service_operation if the client is not running... */
1073 rc
= is_daemon_in_service();
1075 pr_info("%s: Client not running :%d:\n",
1077 is_daemon_in_service());
1082 * The value we want to send back to userspace is in buf.
1084 rc
= kstrtoint(buf
, 0, &val
);
1088 if (!strcmp(kobj_id
, ORANGEFS_KOBJ_ID
)) {
1089 orangefs_attr
= (struct orangefs_attribute
*)attr
;
1091 if (!strcmp(orangefs_attr
->attr
.name
, "perf_history_size")) {
1093 new_op
->upcall
.req
.param
.op
=
1094 ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE
;
1099 } else if (!strcmp(orangefs_attr
->attr
.name
,
1100 "perf_time_interval_secs")) {
1102 new_op
->upcall
.req
.param
.op
=
1103 ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS
;
1108 } else if (!strcmp(orangefs_attr
->attr
.name
,
1109 "perf_counter_reset")) {
1110 if ((val
== 0) || (val
== 1)) {
1111 new_op
->upcall
.req
.param
.op
=
1112 ORANGEFS_PARAM_REQUEST_OP_PERF_RESET
;
1119 } else if (!strcmp(kobj_id
, ACACHE_KOBJ_ID
)) {
1120 acache_attr
= (struct acache_orangefs_attribute
*)attr
;
1122 if (!strcmp(acache_attr
->attr
.name
, "hard_limit")) {
1124 new_op
->upcall
.req
.param
.op
=
1125 ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT
;
1130 } else if (!strcmp(acache_attr
->attr
.name
, "soft_limit")) {
1132 new_op
->upcall
.req
.param
.op
=
1133 ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT
;
1138 } else if (!strcmp(acache_attr
->attr
.name
,
1139 "reclaim_percentage")) {
1140 if ((val
> -1) && (val
< 101)) {
1141 new_op
->upcall
.req
.param
.op
=
1142 ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE
;
1147 } else if (!strcmp(acache_attr
->attr
.name
, "timeout_msecs")) {
1149 new_op
->upcall
.req
.param
.op
=
1150 ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS
;
1157 } else if (!strcmp(kobj_id
, CAPCACHE_KOBJ_ID
)) {
1158 capcache_attr
= (struct capcache_orangefs_attribute
*)attr
;
1160 if (!strcmp(capcache_attr
->attr
.name
, "hard_limit")) {
1162 new_op
->upcall
.req
.param
.op
=
1163 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT
;
1168 } else if (!strcmp(capcache_attr
->attr
.name
, "soft_limit")) {
1170 new_op
->upcall
.req
.param
.op
=
1171 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT
;
1176 } else if (!strcmp(capcache_attr
->attr
.name
,
1177 "reclaim_percentage")) {
1178 if ((val
> -1) && (val
< 101)) {
1179 new_op
->upcall
.req
.param
.op
=
1180 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE
;
1185 } else if (!strcmp(capcache_attr
->attr
.name
, "timeout_secs")) {
1187 new_op
->upcall
.req
.param
.op
=
1188 ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS
;
1195 } else if (!strcmp(kobj_id
, CCACHE_KOBJ_ID
)) {
1196 ccache_attr
= (struct ccache_orangefs_attribute
*)attr
;
1198 if (!strcmp(ccache_attr
->attr
.name
, "hard_limit")) {
1200 new_op
->upcall
.req
.param
.op
=
1201 ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT
;
1206 } else if (!strcmp(ccache_attr
->attr
.name
, "soft_limit")) {
1208 new_op
->upcall
.req
.param
.op
=
1209 ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT
;
1214 } else if (!strcmp(ccache_attr
->attr
.name
,
1215 "reclaim_percentage")) {
1216 if ((val
> -1) && (val
< 101)) {
1217 new_op
->upcall
.req
.param
.op
=
1218 ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE
;
1223 } else if (!strcmp(ccache_attr
->attr
.name
, "timeout_secs")) {
1225 new_op
->upcall
.req
.param
.op
=
1226 ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS
;
1233 } else if (!strcmp(kobj_id
, NCACHE_KOBJ_ID
)) {
1234 ncache_attr
= (struct ncache_orangefs_attribute
*)attr
;
1236 if (!strcmp(ncache_attr
->attr
.name
, "hard_limit")) {
1238 new_op
->upcall
.req
.param
.op
=
1239 ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT
;
1244 } else if (!strcmp(ncache_attr
->attr
.name
, "soft_limit")) {
1246 new_op
->upcall
.req
.param
.op
=
1247 ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT
;
1252 } else if (!strcmp(ncache_attr
->attr
.name
,
1253 "reclaim_percentage")) {
1254 if ((val
> -1) && (val
< 101)) {
1255 new_op
->upcall
.req
.param
.op
=
1256 ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE
;
1261 } else if (!strcmp(ncache_attr
->attr
.name
, "timeout_msecs")) {
1263 new_op
->upcall
.req
.param
.op
=
1264 ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS
;
1272 gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n",
1278 new_op
->upcall
.req
.param
.type
= ORANGEFS_PARAM_REQUEST_SET
;
1280 new_op
->upcall
.req
.param
.value
= val
;
1283 * The service_operation will return a errno return code on
1284 * error, and zero on success.
1286 rc
= service_operation(new_op
, "orangefs_param", ORANGEFS_OP_INTERRUPTIBLE
);
1289 gossip_err("sysfs_service_op_store: service op returned:%d:\n",
1299 if (rc
== -ENOMEM
|| rc
== 0)
1306 service_orangefs_store(struct orangefs_obj
*orangefs_obj
,
1307 struct orangefs_attribute
*attr
,
1313 rc
= sysfs_service_op_store(ORANGEFS_KOBJ_ID
, buf
, (void *) attr
);
1315 /* rc should have an errno value if the service_op went bad. */
1323 service_acache_store(struct acache_orangefs_obj
*acache_orangefs_obj
,
1324 struct acache_orangefs_attribute
*attr
,
1330 rc
= sysfs_service_op_store(ACACHE_KOBJ_ID
, buf
, (void *) attr
);
1332 /* rc should have an errno value if the service_op went bad. */
1340 service_capcache_store(struct capcache_orangefs_obj
1341 *capcache_orangefs_obj
,
1342 struct capcache_orangefs_attribute
*attr
,
1348 rc
= sysfs_service_op_store(CAPCACHE_KOBJ_ID
, buf
, (void *) attr
);
1350 /* rc should have an errno value if the service_op went bad. */
1357 static ssize_t
service_ccache_store(struct ccache_orangefs_obj
1358 *ccache_orangefs_obj
,
1359 struct ccache_orangefs_attribute
*attr
,
1365 rc
= sysfs_service_op_store(CCACHE_KOBJ_ID
, buf
, (void *) attr
);
1367 /* rc should have an errno value if the service_op went bad. */
1375 service_ncache_store(struct ncache_orangefs_obj
*ncache_orangefs_obj
,
1376 struct ncache_orangefs_attribute
*attr
,
1382 rc
= sysfs_service_op_store(NCACHE_KOBJ_ID
, buf
, (void *) attr
);
1384 /* rc should have an errno value if the service_op went bad. */
1391 static struct orangefs_attribute op_timeout_secs_attribute
=
1392 __ATTR(op_timeout_secs
, 0664, int_orangefs_show
, int_store
);
1394 static struct orangefs_attribute slot_timeout_secs_attribute
=
1395 __ATTR(slot_timeout_secs
, 0664, int_orangefs_show
, int_store
);
1397 static struct orangefs_attribute dcache_timeout_msecs_attribute
=
1398 __ATTR(dcache_timeout_msecs
, 0664, int_orangefs_show
, int_store
);
1400 static struct orangefs_attribute getattr_timeout_msecs_attribute
=
1401 __ATTR(getattr_timeout_msecs
, 0664, int_orangefs_show
, int_store
);
1403 static struct orangefs_attribute perf_counter_reset_attribute
=
1404 __ATTR(perf_counter_reset
,
1406 service_orangefs_show
,
1407 service_orangefs_store
);
1409 static struct orangefs_attribute perf_history_size_attribute
=
1410 __ATTR(perf_history_size
,
1412 service_orangefs_show
,
1413 service_orangefs_store
);
1415 static struct orangefs_attribute perf_time_interval_secs_attribute
=
1416 __ATTR(perf_time_interval_secs
,
1418 service_orangefs_show
,
1419 service_orangefs_store
);
1421 static struct attribute
*orangefs_default_attrs
[] = {
1422 &op_timeout_secs_attribute
.attr
,
1423 &slot_timeout_secs_attribute
.attr
,
1424 &dcache_timeout_msecs_attribute
.attr
,
1425 &getattr_timeout_msecs_attribute
.attr
,
1426 &perf_counter_reset_attribute
.attr
,
1427 &perf_history_size_attribute
.attr
,
1428 &perf_time_interval_secs_attribute
.attr
,
1432 static struct kobj_type orangefs_ktype
= {
1433 .sysfs_ops
= &orangefs_sysfs_ops
,
1434 .release
= orangefs_release
,
1435 .default_attrs
= orangefs_default_attrs
,
1438 static struct acache_orangefs_attribute acache_hard_limit_attribute
=
1441 service_acache_show
,
1442 service_acache_store
);
1444 static struct acache_orangefs_attribute acache_reclaim_percent_attribute
=
1445 __ATTR(reclaim_percentage
,
1447 service_acache_show
,
1448 service_acache_store
);
1450 static struct acache_orangefs_attribute acache_soft_limit_attribute
=
1453 service_acache_show
,
1454 service_acache_store
);
1456 static struct acache_orangefs_attribute acache_timeout_msecs_attribute
=
1457 __ATTR(timeout_msecs
,
1459 service_acache_show
,
1460 service_acache_store
);
1462 static struct attribute
*acache_orangefs_default_attrs
[] = {
1463 &acache_hard_limit_attribute
.attr
,
1464 &acache_reclaim_percent_attribute
.attr
,
1465 &acache_soft_limit_attribute
.attr
,
1466 &acache_timeout_msecs_attribute
.attr
,
1470 static struct kobj_type acache_orangefs_ktype
= {
1471 .sysfs_ops
= &acache_orangefs_sysfs_ops
,
1472 .release
= acache_orangefs_release
,
1473 .default_attrs
= acache_orangefs_default_attrs
,
1476 static struct capcache_orangefs_attribute capcache_hard_limit_attribute
=
1479 service_capcache_show
,
1480 service_capcache_store
);
1482 static struct capcache_orangefs_attribute capcache_reclaim_percent_attribute
=
1483 __ATTR(reclaim_percentage
,
1485 service_capcache_show
,
1486 service_capcache_store
);
1488 static struct capcache_orangefs_attribute capcache_soft_limit_attribute
=
1491 service_capcache_show
,
1492 service_capcache_store
);
1494 static struct capcache_orangefs_attribute capcache_timeout_secs_attribute
=
1495 __ATTR(timeout_secs
,
1497 service_capcache_show
,
1498 service_capcache_store
);
1500 static struct attribute
*capcache_orangefs_default_attrs
[] = {
1501 &capcache_hard_limit_attribute
.attr
,
1502 &capcache_reclaim_percent_attribute
.attr
,
1503 &capcache_soft_limit_attribute
.attr
,
1504 &capcache_timeout_secs_attribute
.attr
,
1508 static struct kobj_type capcache_orangefs_ktype
= {
1509 .sysfs_ops
= &capcache_orangefs_sysfs_ops
,
1510 .release
= capcache_orangefs_release
,
1511 .default_attrs
= capcache_orangefs_default_attrs
,
1514 static struct ccache_orangefs_attribute ccache_hard_limit_attribute
=
1517 service_ccache_show
,
1518 service_ccache_store
);
1520 static struct ccache_orangefs_attribute ccache_reclaim_percent_attribute
=
1521 __ATTR(reclaim_percentage
,
1523 service_ccache_show
,
1524 service_ccache_store
);
1526 static struct ccache_orangefs_attribute ccache_soft_limit_attribute
=
1529 service_ccache_show
,
1530 service_ccache_store
);
1532 static struct ccache_orangefs_attribute ccache_timeout_secs_attribute
=
1533 __ATTR(timeout_secs
,
1535 service_ccache_show
,
1536 service_ccache_store
);
1538 static struct attribute
*ccache_orangefs_default_attrs
[] = {
1539 &ccache_hard_limit_attribute
.attr
,
1540 &ccache_reclaim_percent_attribute
.attr
,
1541 &ccache_soft_limit_attribute
.attr
,
1542 &ccache_timeout_secs_attribute
.attr
,
1546 static struct kobj_type ccache_orangefs_ktype
= {
1547 .sysfs_ops
= &ccache_orangefs_sysfs_ops
,
1548 .release
= ccache_orangefs_release
,
1549 .default_attrs
= ccache_orangefs_default_attrs
,
1552 static struct ncache_orangefs_attribute ncache_hard_limit_attribute
=
1555 service_ncache_show
,
1556 service_ncache_store
);
1558 static struct ncache_orangefs_attribute ncache_reclaim_percent_attribute
=
1559 __ATTR(reclaim_percentage
,
1561 service_ncache_show
,
1562 service_ncache_store
);
1564 static struct ncache_orangefs_attribute ncache_soft_limit_attribute
=
1567 service_ncache_show
,
1568 service_ncache_store
);
1570 static struct ncache_orangefs_attribute ncache_timeout_msecs_attribute
=
1571 __ATTR(timeout_msecs
,
1573 service_ncache_show
,
1574 service_ncache_store
);
1576 static struct attribute
*ncache_orangefs_default_attrs
[] = {
1577 &ncache_hard_limit_attribute
.attr
,
1578 &ncache_reclaim_percent_attribute
.attr
,
1579 &ncache_soft_limit_attribute
.attr
,
1580 &ncache_timeout_msecs_attribute
.attr
,
1584 static struct kobj_type ncache_orangefs_ktype
= {
1585 .sysfs_ops
= &ncache_orangefs_sysfs_ops
,
1586 .release
= ncache_orangefs_release
,
1587 .default_attrs
= ncache_orangefs_default_attrs
,
1590 static struct pc_orangefs_attribute pc_acache_attribute
=
1596 static struct pc_orangefs_attribute pc_capcache_attribute
=
1602 static struct pc_orangefs_attribute pc_ncache_attribute
=
1608 static struct attribute
*pc_orangefs_default_attrs
[] = {
1609 &pc_acache_attribute
.attr
,
1610 &pc_capcache_attribute
.attr
,
1611 &pc_ncache_attribute
.attr
,
1615 static struct kobj_type pc_orangefs_ktype
= {
1616 .sysfs_ops
= &pc_orangefs_sysfs_ops
,
1617 .release
= pc_orangefs_release
,
1618 .default_attrs
= pc_orangefs_default_attrs
,
1621 static struct stats_orangefs_attribute stats_reads_attribute
=
1627 static struct stats_orangefs_attribute stats_writes_attribute
=
1633 static struct attribute
*stats_orangefs_default_attrs
[] = {
1634 &stats_reads_attribute
.attr
,
1635 &stats_writes_attribute
.attr
,
1639 static struct kobj_type stats_orangefs_ktype
= {
1640 .sysfs_ops
= &stats_orangefs_sysfs_ops
,
1641 .release
= stats_orangefs_release
,
1642 .default_attrs
= stats_orangefs_default_attrs
,
1645 static struct orangefs_obj
*orangefs_obj
;
1646 static struct acache_orangefs_obj
*acache_orangefs_obj
;
1647 static struct capcache_orangefs_obj
*capcache_orangefs_obj
;
1648 static struct ccache_orangefs_obj
*ccache_orangefs_obj
;
1649 static struct ncache_orangefs_obj
*ncache_orangefs_obj
;
1650 static struct pc_orangefs_obj
*pc_orangefs_obj
;
1651 static struct stats_orangefs_obj
*stats_orangefs_obj
;
1653 int orangefs_sysfs_init(void)
1657 gossip_debug(GOSSIP_SYSFS_DEBUG
, "orangefs_sysfs_init: start\n");
1659 /* create /sys/fs/orangefs. */
1660 orangefs_obj
= kzalloc(sizeof(*orangefs_obj
), GFP_KERNEL
);
1664 rc
= kobject_init_and_add(&orangefs_obj
->kobj
,
1672 kobject_uevent(&orangefs_obj
->kobj
, KOBJ_ADD
);
1674 /* create /sys/fs/orangefs/acache. */
1675 acache_orangefs_obj
= kzalloc(sizeof(*acache_orangefs_obj
), GFP_KERNEL
);
1676 if (!acache_orangefs_obj
) {
1681 rc
= kobject_init_and_add(&acache_orangefs_obj
->kobj
,
1682 &acache_orangefs_ktype
,
1683 &orangefs_obj
->kobj
,
1687 goto acache_obj_bail
;
1689 kobject_uevent(&acache_orangefs_obj
->kobj
, KOBJ_ADD
);
1691 /* create /sys/fs/orangefs/capcache. */
1692 capcache_orangefs_obj
=
1693 kzalloc(sizeof(*capcache_orangefs_obj
), GFP_KERNEL
);
1694 if (!capcache_orangefs_obj
) {
1696 goto acache_obj_bail
;
1699 rc
= kobject_init_and_add(&capcache_orangefs_obj
->kobj
,
1700 &capcache_orangefs_ktype
,
1701 &orangefs_obj
->kobj
,
1704 goto capcache_obj_bail
;
1706 kobject_uevent(&capcache_orangefs_obj
->kobj
, KOBJ_ADD
);
1708 /* create /sys/fs/orangefs/ccache. */
1709 ccache_orangefs_obj
=
1710 kzalloc(sizeof(*ccache_orangefs_obj
), GFP_KERNEL
);
1711 if (!ccache_orangefs_obj
) {
1713 goto capcache_obj_bail
;
1716 rc
= kobject_init_and_add(&ccache_orangefs_obj
->kobj
,
1717 &ccache_orangefs_ktype
,
1718 &orangefs_obj
->kobj
,
1721 goto ccache_obj_bail
;
1723 kobject_uevent(&ccache_orangefs_obj
->kobj
, KOBJ_ADD
);
1725 /* create /sys/fs/orangefs/ncache. */
1726 ncache_orangefs_obj
= kzalloc(sizeof(*ncache_orangefs_obj
), GFP_KERNEL
);
1727 if (!ncache_orangefs_obj
) {
1729 goto ccache_obj_bail
;
1732 rc
= kobject_init_and_add(&ncache_orangefs_obj
->kobj
,
1733 &ncache_orangefs_ktype
,
1734 &orangefs_obj
->kobj
,
1738 goto ncache_obj_bail
;
1740 kobject_uevent(&ncache_orangefs_obj
->kobj
, KOBJ_ADD
);
1742 /* create /sys/fs/orangefs/perf_counters. */
1743 pc_orangefs_obj
= kzalloc(sizeof(*pc_orangefs_obj
), GFP_KERNEL
);
1744 if (!pc_orangefs_obj
) {
1746 goto ncache_obj_bail
;
1749 rc
= kobject_init_and_add(&pc_orangefs_obj
->kobj
,
1751 &orangefs_obj
->kobj
,
1757 kobject_uevent(&pc_orangefs_obj
->kobj
, KOBJ_ADD
);
1759 /* create /sys/fs/orangefs/stats. */
1760 stats_orangefs_obj
= kzalloc(sizeof(*stats_orangefs_obj
), GFP_KERNEL
);
1761 if (!stats_orangefs_obj
) {
1766 rc
= kobject_init_and_add(&stats_orangefs_obj
->kobj
,
1767 &stats_orangefs_ktype
,
1768 &orangefs_obj
->kobj
,
1772 goto stats_obj_bail
;
1774 kobject_uevent(&stats_orangefs_obj
->kobj
, KOBJ_ADD
);
1778 kobject_put(&stats_orangefs_obj
->kobj
);
1781 kobject_put(&pc_orangefs_obj
->kobj
);
1784 kobject_put(&ncache_orangefs_obj
->kobj
);
1787 kobject_put(&ccache_orangefs_obj
->kobj
);
1790 kobject_put(&capcache_orangefs_obj
->kobj
);
1793 kobject_put(&acache_orangefs_obj
->kobj
);
1796 kobject_put(&orangefs_obj
->kobj
);
1801 void orangefs_sysfs_exit(void)
1803 gossip_debug(GOSSIP_SYSFS_DEBUG
, "orangefs_sysfs_exit: start\n");
1805 kobject_put(&acache_orangefs_obj
->kobj
);
1806 kobject_put(&capcache_orangefs_obj
->kobj
);
1807 kobject_put(&ccache_orangefs_obj
->kobj
);
1808 kobject_put(&ncache_orangefs_obj
->kobj
);
1809 kobject_put(&pc_orangefs_obj
->kobj
);
1810 kobject_put(&stats_orangefs_obj
->kobj
);
1812 kobject_put(&orangefs_obj
->kobj
);