^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Documentation/ABI/stable/sysfs-fs-orangefs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * What: /sys/fs/orangefs/perf_counter_reset
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Date: June 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * echo a 0 or a 1 into perf_counter_reset to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * reset all the counters in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * /sys/fs/orangefs/perf_counters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * except ones with PINT_PERF_PRESERVE set.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * What: /sys/fs/orangefs/perf_counters/...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * Counters and settings for various caches.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * Read only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * What: /sys/fs/orangefs/perf_time_interval_secs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * Length of perf counter intervals in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * seconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) * What: /sys/fs/orangefs/perf_history_size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) * The perf_counters cache statistics have N, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * perf_history_size, samples. The default is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * Every perf_time_interval_secs the (first)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * samples are reset.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) * If N is greater than one, the "current" set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * of samples is reset, and the samples from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * other N-1 intervals remain available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * What: /sys/fs/orangefs/op_timeout_secs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * Service operation timeout in seconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * What: /sys/fs/orangefs/slot_timeout_secs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * "Slot" timeout in seconds. A "slot"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * is an indexed buffer in the shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) * memory segment used for communication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * between the kernel module and userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) * Slots are requested and waited for,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * the wait times out after slot_timeout_secs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * What: /sys/fs/orangefs/cache_timeout_msecs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * Date: Mar 2018
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) * Time in milliseconds between which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * orangefs_revalidate_mapping will invalidate the page
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) * cache.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * What: /sys/fs/orangefs/dcache_timeout_msecs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) * Date: Jul 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) * Time lookup is valid in milliseconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * What: /sys/fs/orangefs/getattr_timeout_msecs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) * Date: Jul 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * Time getattr is valid in milliseconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * What: /sys/fs/orangefs/readahead_count
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * Date: Aug 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * Readahead cache buffer count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * What: /sys/fs/orangefs/readahead_size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * Date: Aug 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * Readahead cache buffer size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * What: /sys/fs/orangefs/readahead_count_size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * Date: Aug 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * Readahead cache buffer count and size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * What: /sys/fs/orangefs/readahead_readcnt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * Date: Jan 2017
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * Number of buffers (in multiples of readahead_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * which can be read ahead for a single file at once.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * What: /sys/fs/orangefs/acache/...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) * Contact: Martin Brandenburg <martin@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) * Attribute cache configurable settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * What: /sys/fs/orangefs/ncache/...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * Name cache configurable settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * What: /sys/fs/orangefs/capcache/...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * Capability cache configurable settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * What: /sys/fs/orangefs/ccache/...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * Date: Jun 2015
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * Contact: Mike Marshall <hubcap@omnibond.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * Description:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * Credential cache configurable settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #include <linux/kobject.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #include <linux/sysfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #include "protocol.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #include "orangefs-kernel.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #include "orangefs-sysfs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define ORANGEFS_KOBJ_ID "orangefs"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) #define ACACHE_KOBJ_ID "acache"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) #define CAPCACHE_KOBJ_ID "capcache"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) #define CCACHE_KOBJ_ID "ccache"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) #define NCACHE_KOBJ_ID "ncache"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) #define PC_KOBJ_ID "pc"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) #define STATS_KOBJ_ID "stats"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * Every item calls orangefs_attr_show and orangefs_attr_store through
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) * orangefs_sysfs_ops. They look at the orangefs_attributes further below to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * call one of sysfs_int_show, sysfs_int_store, sysfs_service_op_show, or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * sysfs_service_op_store.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) struct orangefs_attribute {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) struct attribute attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) ssize_t (*show)(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct orangefs_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) ssize_t (*store)(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct orangefs_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) const char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) size_t count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static ssize_t orangefs_attr_show(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) struct attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct orangefs_attribute *attribute;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) attribute = container_of(attr, struct orangefs_attribute, attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) if (!attribute->show)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) return attribute->show(kobj, attribute, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static ssize_t orangefs_attr_store(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) struct attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) const char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) size_t len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) struct orangefs_attribute *attribute;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) if (!strcmp(kobj->name, PC_KOBJ_ID) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) !strcmp(kobj->name, STATS_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return -EPERM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) attribute = container_of(attr, struct orangefs_attribute, attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (!attribute->store)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) return attribute->store(kobj, attribute, buf, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) static const struct sysfs_ops orangefs_sysfs_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) .show = orangefs_attr_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) .store = orangefs_attr_store,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static ssize_t sysfs_int_show(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) struct orangefs_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) int rc = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) gossip_debug(GOSSIP_SYSFS_DEBUG, "sysfs_int_show: id:%s:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) kobj->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (!strcmp(attr->attr.name, "op_timeout_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) "%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) op_timeout_secs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) "slot_timeout_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) "%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) slot_timeout_secs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) "cache_timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) "%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) orangefs_cache_timeout_msecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) "dcache_timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) "%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) orangefs_dcache_timeout_msecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) "getattr_timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) "%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) orangefs_getattr_timeout_msecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) } else if (!strcmp(kobj->name, STATS_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) if (!strcmp(attr->attr.name, "reads")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) "%lu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) orangefs_stats.reads);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) } else if (!strcmp(attr->attr.name, "writes")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) rc = scnprintf(buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) "%lu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) orangefs_stats.writes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static ssize_t sysfs_int_store(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) struct orangefs_attribute *attr, const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) gossip_debug(GOSSIP_SYSFS_DEBUG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) "sysfs_int_store: start attr->attr.name:%s: buf:%s:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) attr->attr.name, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) if (!strcmp(attr->attr.name, "op_timeout_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) rc = kstrtoint(buf, 0, &op_timeout_secs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) } else if (!strcmp(attr->attr.name, "slot_timeout_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) rc = kstrtoint(buf, 0, &slot_timeout_secs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) } else if (!strcmp(attr->attr.name, "cache_timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) rc = kstrtoint(buf, 0, &orangefs_cache_timeout_msecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) } else if (!strcmp(attr->attr.name, "dcache_timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) rc = kstrtoint(buf, 0, &orangefs_dcache_timeout_msecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) } else if (!strcmp(attr->attr.name, "getattr_timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) rc = kstrtoint(buf, 0, &orangefs_getattr_timeout_msecs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) rc = count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) * obtain attribute values from userspace with a service operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) static ssize_t sysfs_service_op_show(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) struct orangefs_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) struct orangefs_kernel_op_s *new_op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) char *ser_op_type = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) __u32 op_alloc_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) gossip_debug(GOSSIP_SYSFS_DEBUG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) "sysfs_service_op_show: id:%s:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) kobj->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) if (strcmp(kobj->name, PC_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) op_alloc_type = ORANGEFS_VFS_OP_PARAM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) op_alloc_type = ORANGEFS_VFS_OP_PERF_COUNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) new_op = op_alloc(op_alloc_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) if (!new_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /* Can't do a service_operation if the client is not running... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) rc = is_daemon_in_service();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) if (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) pr_info_ratelimited("%s: Client not running :%d:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) is_daemon_in_service());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) if (strcmp(kobj->name, PC_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_GET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) /* Drop unsupported requests first. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) (!strcmp(attr->attr.name, "readahead_count") ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) !strcmp(attr->attr.name, "readahead_size") ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) !strcmp(attr->attr.name, "readahead_count_size") ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) !strcmp(attr->attr.name, "readahead_readcnt"))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) if (!strcmp(attr->attr.name, "perf_history_size"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) "perf_time_interval_secs"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) "perf_counter_reset"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) ORANGEFS_PARAM_REQUEST_OP_PERF_RESET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) "readahead_count"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) "readahead_size"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) "readahead_count_size"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) "readahead_readcnt"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) if (!strcmp(attr->attr.name, "timeout_msecs"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) if (!strcmp(attr->attr.name, "hard_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) if (!strcmp(attr->attr.name, "soft_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) if (!strcmp(attr->attr.name, "reclaim_percentage"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) } else if (!strcmp(kobj->name, CAPCACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) if (!strcmp(attr->attr.name, "timeout_secs"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) if (!strcmp(attr->attr.name, "hard_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) if (!strcmp(attr->attr.name, "soft_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) if (!strcmp(attr->attr.name, "reclaim_percentage"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) } else if (!strcmp(kobj->name, CCACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) if (!strcmp(attr->attr.name, "timeout_secs"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) if (!strcmp(attr->attr.name, "hard_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) if (!strcmp(attr->attr.name, "soft_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) if (!strcmp(attr->attr.name, "reclaim_percentage"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) } else if (!strcmp(kobj->name, NCACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) if (!strcmp(attr->attr.name, "timeout_msecs"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) if (!strcmp(attr->attr.name, "hard_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) if (!strcmp(attr->attr.name, "soft_limit"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) if (!strcmp(attr->attr.name, "reclaim_percentage"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) } else if (!strcmp(kobj->name, PC_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) if (!strcmp(attr->attr.name, ACACHE_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) new_op->upcall.req.perf_count.type =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) ORANGEFS_PERF_COUNT_REQUEST_ACACHE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) if (!strcmp(attr->attr.name, CAPCACHE_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) new_op->upcall.req.perf_count.type =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) if (!strcmp(attr->attr.name, NCACHE_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) new_op->upcall.req.perf_count.type =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ORANGEFS_PERF_COUNT_REQUEST_NCACHE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) kobj->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) if (strcmp(kobj->name, PC_KOBJ_ID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) ser_op_type = "orangefs_param";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) ser_op_type = "orangefs_perf_count";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) * The service_operation will return an errno return code on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) * error, and zero on success.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) rc = service_operation(new_op, ser_op_type, ORANGEFS_OP_INTERRUPTIBLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) if (!rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) if (strcmp(kobj->name, PC_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) if (new_op->upcall.req.param.op ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) rc = scnprintf(buf, PAGE_SIZE, "%d %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) (int)new_op->downcall.resp.param.u.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) value32[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) (int)new_op->downcall.resp.param.u.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) value32[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) rc = scnprintf(buf, PAGE_SIZE, "%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) (int)new_op->downcall.resp.param.u.value64);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) rc = scnprintf(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) PAGE_SIZE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) "%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) new_op->downcall.resp.perf_count.buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) op_release(new_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) * pass attribute values back to userspace with a service operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) * We have to do a memory allocation, an sscanf and a service operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) * And we have to evaluate what the user entered, to make sure the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) * value is within the range supported by the attribute. So, there's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) * a lot of return code checking and mapping going on here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) * We want to return 1 if we think everything went OK, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) * EINVAL if not.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) static ssize_t sysfs_service_op_store(struct kobject *kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) struct orangefs_attribute *attr, const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) struct orangefs_kernel_op_s *new_op = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) int val = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) gossip_debug(GOSSIP_SYSFS_DEBUG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) "sysfs_service_op_store: id:%s:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) kobj->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) new_op = op_alloc(ORANGEFS_VFS_OP_PARAM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) if (!new_op)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) return -EINVAL; /* sic */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) /* Can't do a service_operation if the client is not running... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) rc = is_daemon_in_service();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) if (rc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) pr_info("%s: Client not running :%d:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) is_daemon_in_service());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) * The value we want to send back to userspace is in buf, unless this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) * there are two parameters, which is specially handled below.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) if (strcmp(kobj->name, ORANGEFS_KOBJ_ID) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) strcmp(attr->attr.name, "readahead_count_size")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) rc = kstrtoint(buf, 0, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) /* Drop unsupported requests first. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) (!strcmp(attr->attr.name, "readahead_count") ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) !strcmp(attr->attr.name, "readahead_size") ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) !strcmp(attr->attr.name, "readahead_count_size") ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) !strcmp(attr->attr.name, "readahead_readcnt"))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) if (!strcmp(attr->attr.name, "perf_history_size")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) if (val > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) "perf_time_interval_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) if (val > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) "perf_counter_reset")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) if ((val == 0) || (val == 1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) ORANGEFS_PARAM_REQUEST_OP_PERF_RESET;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) "readahead_count")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) if ((val >= 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) "readahead_size")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) if ((val >= 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) "readahead_count_size")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) int val1, val2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) rc = sscanf(buf, "%d %d", &val1, &val2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) if (rc < 2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) if ((val1 >= 0) && (val2 >= 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) new_op->upcall.req.param.u.value32[0] = val1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) new_op->upcall.req.param.u.value32[1] = val2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) goto value_set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) "readahead_readcnt")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) if ((val >= 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) ORANGEFS_PARAM_REQUEST_OP_READAHEAD_READCNT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) if (!strcmp(attr->attr.name, "hard_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) } else if (!strcmp(attr->attr.name, "soft_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) "reclaim_percentage")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) if ((val > -1) && (val < 101)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) } else if (!strcmp(attr->attr.name, "timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) } else if (!strcmp(kobj->name, CAPCACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) if (!strcmp(attr->attr.name, "hard_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) } else if (!strcmp(attr->attr.name, "soft_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) "reclaim_percentage")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711) if ((val > -1) && (val < 101)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718) } else if (!strcmp(attr->attr.name, "timeout_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) } else if (!strcmp(kobj->name, CCACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729) if (!strcmp(attr->attr.name, "hard_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) } else if (!strcmp(attr->attr.name, "soft_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) "reclaim_percentage")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) if ((val > -1) && (val < 101)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) } else if (!strcmp(attr->attr.name, "timeout_secs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) } else if (!strcmp(kobj->name, NCACHE_KOBJ_ID)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) if (!strcmp(attr->attr.name, "hard_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) } else if (!strcmp(attr->attr.name, "soft_limit")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776) ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781) } else if (!strcmp(attr->attr.name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) "reclaim_percentage")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783) if ((val > -1) && (val < 101)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) } else if (!strcmp(attr->attr.name, "timeout_msecs")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) if (val > -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) new_op->upcall.req.param.op =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 793) ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 794) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 795) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 796) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 797) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 798) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 799)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 800) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 801) gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 802) kobj->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 803) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 804) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 805) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 806)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 807) new_op->upcall.req.param.u.value64 = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 808) value_set:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 809)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 810) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 811) * The service_operation will return a errno return code on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 812) * error, and zero on success.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 813) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 814) rc = service_operation(new_op, "orangefs_param", ORANGEFS_OP_INTERRUPTIBLE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 815)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 816) if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 817) gossip_err("sysfs_service_op_store: service op returned:%d:\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 818) rc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 819) rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 820) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 821) rc = count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 822) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 823)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 824) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 825) op_release(new_op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 826)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 827) if (rc == -ENOMEM || rc == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 828) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 829)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 830) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 831) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 832)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 833) static struct orangefs_attribute op_timeout_secs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 834) __ATTR(op_timeout_secs, 0664, sysfs_int_show, sysfs_int_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 835)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 836) static struct orangefs_attribute slot_timeout_secs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 837) __ATTR(slot_timeout_secs, 0664, sysfs_int_show, sysfs_int_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 838)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 839) static struct orangefs_attribute cache_timeout_msecs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 840) __ATTR(cache_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 841)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 842) static struct orangefs_attribute dcache_timeout_msecs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 843) __ATTR(dcache_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 844)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 845) static struct orangefs_attribute getattr_timeout_msecs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 846) __ATTR(getattr_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 847)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 848) static struct orangefs_attribute readahead_count_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 849) __ATTR(readahead_count, 0664, sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 850) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 851)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 852) static struct orangefs_attribute readahead_size_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 853) __ATTR(readahead_size, 0664, sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 854) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 855)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 856) static struct orangefs_attribute readahead_count_size_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 857) __ATTR(readahead_count_size, 0664, sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 858) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 859)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 860) static struct orangefs_attribute readahead_readcnt_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 861) __ATTR(readahead_readcnt, 0664, sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 862) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 863)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 864) static struct orangefs_attribute perf_counter_reset_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 865) __ATTR(perf_counter_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 866) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 867) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 868) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 869)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 870) static struct orangefs_attribute perf_history_size_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 871) __ATTR(perf_history_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 872) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 873) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 874) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 875)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 876) static struct orangefs_attribute perf_time_interval_secs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 877) __ATTR(perf_time_interval_secs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 878) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 879) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 880) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 881)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 882) static struct attribute *orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 883) &op_timeout_secs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 884) &slot_timeout_secs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 885) &cache_timeout_msecs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 886) &dcache_timeout_msecs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 887) &getattr_timeout_msecs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 888) &readahead_count_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 889) &readahead_size_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 890) &readahead_count_size_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 891) &readahead_readcnt_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 892) &perf_counter_reset_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 893) &perf_history_size_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 894) &perf_time_interval_secs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 895) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 896) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 897)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 898) static struct kobj_type orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 899) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 900) .default_attrs = orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 901) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 902)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 903) static struct orangefs_attribute acache_hard_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 904) __ATTR(hard_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 905) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 906) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 907) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 908)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 909) static struct orangefs_attribute acache_reclaim_percent_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 910) __ATTR(reclaim_percentage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 911) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 912) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 913) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 914)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 915) static struct orangefs_attribute acache_soft_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 916) __ATTR(soft_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 917) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 918) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 919) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 920)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 921) static struct orangefs_attribute acache_timeout_msecs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 922) __ATTR(timeout_msecs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 923) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 924) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 925) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 926)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 927) static struct attribute *acache_orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 928) &acache_hard_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 929) &acache_reclaim_percent_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 930) &acache_soft_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 931) &acache_timeout_msecs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 932) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 933) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 934)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 935) static struct kobj_type acache_orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 936) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 937) .default_attrs = acache_orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 938) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 939)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 940) static struct orangefs_attribute capcache_hard_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 941) __ATTR(hard_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 942) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 943) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 944) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 945)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 946) static struct orangefs_attribute capcache_reclaim_percent_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 947) __ATTR(reclaim_percentage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 948) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 949) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 950) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 951)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 952) static struct orangefs_attribute capcache_soft_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 953) __ATTR(soft_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 954) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 955) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 956) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 957)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 958) static struct orangefs_attribute capcache_timeout_secs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 959) __ATTR(timeout_secs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 960) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 961) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 962) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 963)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 964) static struct attribute *capcache_orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 965) &capcache_hard_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 966) &capcache_reclaim_percent_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 967) &capcache_soft_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 968) &capcache_timeout_secs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 969) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 970) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 971)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 972) static struct kobj_type capcache_orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 973) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 974) .default_attrs = capcache_orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 975) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 976)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 977) static struct orangefs_attribute ccache_hard_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 978) __ATTR(hard_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 979) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 980) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 981) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 982)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 983) static struct orangefs_attribute ccache_reclaim_percent_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 984) __ATTR(reclaim_percentage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 985) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 986) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 987) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 988)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 989) static struct orangefs_attribute ccache_soft_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 990) __ATTR(soft_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 991) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 992) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 993) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 994)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 995) static struct orangefs_attribute ccache_timeout_secs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 996) __ATTR(timeout_secs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 997) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 998) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 999) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) static struct attribute *ccache_orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) &ccache_hard_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) &ccache_reclaim_percent_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) &ccache_soft_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) &ccache_timeout_secs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) static struct kobj_type ccache_orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) .default_attrs = ccache_orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) static struct orangefs_attribute ncache_hard_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) __ATTR(hard_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) static struct orangefs_attribute ncache_reclaim_percent_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) __ATTR(reclaim_percentage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) static struct orangefs_attribute ncache_soft_limit_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) __ATTR(soft_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) static struct orangefs_attribute ncache_timeout_msecs_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) __ATTR(timeout_msecs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) sysfs_service_op_store);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) static struct attribute *ncache_orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) &ncache_hard_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) &ncache_reclaim_percent_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) &ncache_soft_limit_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) &ncache_timeout_msecs_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) static struct kobj_type ncache_orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) .default_attrs = ncache_orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) static struct orangefs_attribute pc_acache_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) __ATTR(acache,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) static struct orangefs_attribute pc_capcache_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) __ATTR(capcache,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) static struct orangefs_attribute pc_ncache_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) __ATTR(ncache,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) sysfs_service_op_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) static struct attribute *pc_orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) &pc_acache_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) &pc_capcache_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) &pc_ncache_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) static struct kobj_type pc_orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) .default_attrs = pc_orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) static struct orangefs_attribute stats_reads_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) __ATTR(reads,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) sysfs_int_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) static struct orangefs_attribute stats_writes_attribute =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) __ATTR(writes,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 0664,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) sysfs_int_show,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) static struct attribute *stats_orangefs_default_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) &stats_reads_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) &stats_writes_attribute.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) static struct kobj_type stats_orangefs_ktype = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) .sysfs_ops = &orangefs_sysfs_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) .default_attrs = stats_orangefs_default_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) static struct kobject *orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) static struct kobject *acache_orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) static struct kobject *capcache_orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) static struct kobject *ccache_orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) static struct kobject *ncache_orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) static struct kobject *pc_orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) static struct kobject *stats_orangefs_obj;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) int orangefs_sysfs_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) int rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) gossip_debug(GOSSIP_SYSFS_DEBUG, "orangefs_sysfs_init: start\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) /* create /sys/fs/orangefs. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) orangefs_obj = kzalloc(sizeof(*orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) if (!orangefs_obj)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) rc = kobject_init_and_add(orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) &orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) fs_kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) ORANGEFS_KOBJ_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) goto ofs_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) kobject_uevent(orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) /* create /sys/fs/orangefs/acache. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) acache_orangefs_obj = kzalloc(sizeof(*acache_orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) if (!acache_orangefs_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) goto ofs_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) rc = kobject_init_and_add(acache_orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) &acache_orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) ACACHE_KOBJ_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) goto acache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) kobject_uevent(acache_orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) /* create /sys/fs/orangefs/capcache. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) capcache_orangefs_obj =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) kzalloc(sizeof(*capcache_orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) if (!capcache_orangefs_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) goto acache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) rc = kobject_init_and_add(capcache_orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) &capcache_orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) CAPCACHE_KOBJ_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) goto capcache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) kobject_uevent(capcache_orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) /* create /sys/fs/orangefs/ccache. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) ccache_orangefs_obj =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) kzalloc(sizeof(*ccache_orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) if (!ccache_orangefs_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) goto capcache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) rc = kobject_init_and_add(ccache_orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) &ccache_orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) CCACHE_KOBJ_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) goto ccache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) kobject_uevent(ccache_orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) /* create /sys/fs/orangefs/ncache. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) ncache_orangefs_obj = kzalloc(sizeof(*ncache_orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) if (!ncache_orangefs_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) goto ccache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) rc = kobject_init_and_add(ncache_orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) &ncache_orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) NCACHE_KOBJ_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) goto ncache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) kobject_uevent(ncache_orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) /* create /sys/fs/orangefs/perf_counters. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) pc_orangefs_obj = kzalloc(sizeof(*pc_orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) if (!pc_orangefs_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) goto ncache_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) rc = kobject_init_and_add(pc_orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) &pc_orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) "perf_counters");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) goto pc_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) kobject_uevent(pc_orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) /* create /sys/fs/orangefs/stats. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) stats_orangefs_obj = kzalloc(sizeof(*stats_orangefs_obj), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) if (!stats_orangefs_obj) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) rc = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) goto pc_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) rc = kobject_init_and_add(stats_orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) &stats_orangefs_ktype,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) orangefs_obj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) STATS_KOBJ_ID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) goto stats_obj_bail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) kobject_uevent(stats_orangefs_obj, KOBJ_ADD);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) stats_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) kobject_put(stats_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) pc_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) kobject_put(pc_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) ncache_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) kobject_put(ncache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) ccache_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) kobject_put(ccache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) capcache_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) kobject_put(capcache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) acache_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) kobject_put(acache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) ofs_obj_bail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) kobject_put(orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) void orangefs_sysfs_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) gossip_debug(GOSSIP_SYSFS_DEBUG, "orangefs_sysfs_exit: start\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) kobject_put(acache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) kobject_put(capcache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) kobject_put(ccache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) kobject_put(ncache_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) kobject_put(pc_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) kobject_put(stats_orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) kobject_put(orangefs_obj);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) }