// SPDX-License-Identifier: GPL-2.0
/*
* Documentation/ABI/stable/sysfs-fs-orangefs:
*
* What: /sys/fs/orangefs/perf_counter_reset
* Date: June 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* echo a 0 or a 1 into perf_counter_reset to
* reset all the counters in
* /sys/fs/orangefs/perf_counters
* except ones with PINT_PERF_PRESERVE set.
*
*
* What: /sys/fs/orangefs/perf_counters/...
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* Counters and settings for various caches.
* Read only.
*
*
* What: /sys/fs/orangefs/perf_time_interval_secs
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* Length of perf counter intervals in
* seconds.
*
*
* What: /sys/fs/orangefs/perf_history_size
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* The perf_counters cache statistics have N, or
* perf_history_size, samples. The default is
* one.
*
* Every perf_time_interval_secs the (first)
* samples are reset.
*
* If N is greater than one, the "current" set
* of samples is reset, and the samples from the
* other N-1 intervals remain available.
*
*
* What: /sys/fs/orangefs/op_timeout_secs
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* Service operation timeout in seconds.
*
*
* What: /sys/fs/orangefs/slot_timeout_secs
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* "Slot" timeout in seconds. A "slot"
* is an indexed buffer in the shared
* memory segment used for communication
* between the kernel module and userspace.
* Slots are requested and waited for,
* the wait times out after slot_timeout_secs.
*
* What: /sys/fs/orangefs/dcache_timeout_msecs
* Date: Jul 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Time lookup is valid in milliseconds.
*
* What: /sys/fs/orangefs/getattr_timeout_msecs
* Date: Jul 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Time getattr is valid in milliseconds.
*
* What: /sys/fs/orangefs/readahead_count
* Date: Aug 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Readahead cache buffer count.
*
* What: /sys/fs/orangefs/readahead_size
* Date: Aug 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Readahead cache buffer size.
*
* What: /sys/fs/orangefs/readahead_count_size
* Date: Aug 2016
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Readahead cache buffer count and size.
*
* What: /sys/fs/orangefs/readahead_readcnt
* Date: Jan 2017
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Number of buffers (in multiples of readahead_size)
* which can be read ahead for a single file at once.
*
* What: /sys/fs/orangefs/acache/...
* Date: Jun 2015
* Contact: Martin Brandenburg <martin@omnibond.com>
* Description:
* Attribute cache configurable settings.
*
*
* What: /sys/fs/orangefs/ncache/...
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* Name cache configurable settings.
*
*
* What: /sys/fs/orangefs/capcache/...
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* Capability cache configurable settings.
*
*
* What: /sys/fs/orangefs/ccache/...
* Date: Jun 2015
* Contact: Mike Marshall <hubcap@omnibond.com>
* Description:
* Credential cache configurable settings.
*
*/
#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/module.h>
#include <linux/init.h>
#include "protocol.h"
#include "orangefs-kernel.h"
#include "orangefs-sysfs.h"
#define ORANGEFS_KOBJ_ID "orangefs"
#define ACACHE_KOBJ_ID "acache"
#define CAPCACHE_KOBJ_ID "capcache"
#define CCACHE_KOBJ_ID "ccache"
#define NCACHE_KOBJ_ID "ncache"
#define PC_KOBJ_ID "pc"
#define STATS_KOBJ_ID "stats"
/*
* Every item calls orangefs_attr_show and orangefs_attr_store through
* orangefs_sysfs_ops. They look at the orangefs_attributes further below to
* call one of sysfs_int_show, sysfs_int_store, sysfs_service_op_show, or
* sysfs_service_op_store.
*/
struct orangefs_attribute {
struct attribute attr;
ssize_t (*show)(struct kobject *kobj,
struct orangefs_attribute *attr,
char *buf);
ssize_t (*store)(struct kobject *kobj,
struct orangefs_attribute *attr,
const char *buf,
size_t count);
};
static ssize_t orangefs_attr_show(struct kobject *kobj,
struct attribute *attr,
char *buf)
{
struct orangefs_attribute *attribute;
attribute = container_of(attr, struct orangefs_attribute, attr);
if (!attribute->show)
return -EIO;
return attribute->show(kobj, attribute, buf);
}
static ssize_t orangefs_attr_store(struct kobject *kobj,
struct attribute *attr,
const char *buf,