*/
/*
* This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/obdclass/obd_sysfs.c
*
#include <linux/kobject.h>
#include <libcfs/libcfs.h>
+#include <libcfs/libcfs_crypto.h>
#include <obd_support.h>
#include <obd_class.h>
#include <lprocfs_status.h>
}
LUSTRE_RW_ATTR(max_dirty_mb);
+#ifdef HAVE_SERVER_SUPPORT
+static ssize_t no_transno_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *obd;
+ unsigned int idx;
+ int rc;
+
+ rc = kstrtouint(buffer, 10, &idx);
+ if (rc)
+ return rc;
+
+ obd = class_num2obd(idx);
+ if (!obd || !obd->obd_attached) {
+ if (obd)
+ CERROR("%s: not attached\n", obd->obd_name);
+ return -ENODEV;
+ }
+
+ spin_lock(&obd->obd_dev_lock);
+ obd->obd_no_transno = 1;
+ spin_unlock(&obd->obd_dev_lock);
+ return count;
+}
+LUSTRE_WO_ATTR(no_transno);
+#endif /* HAVE_SERVER_SUPPORT */
+
static ssize_t version_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
static ssize_t pinger_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
-#ifdef ENABLE_PINGER
+#ifdef CONFIG_LUSTRE_FS_PINGER
const char *state = "on";
#else
const char *state = "off";
int rc = 0;
if (strlen(obd_jobid_var))
- rc = snprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_var);
+ rc = scnprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_var);
return rc;
}
int rc = 0;
if (strlen(obd_jobid_name))
- rc = snprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_name);
+ rc = scnprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_name);
return rc;
}
rcu_read_lock();
jid = jobid_current();
if (jid)
- ret = snprintf(buf, PAGE_SIZE, "%s\n", jid);
+ ret = scnprintf(buf, PAGE_SIZE, "%s\n", jid);
rcu_read_unlock();
return ret;
}
#ifdef HAVE_SERVER_SUPPORT
&lustre_sattr_ldlm_timeout.u.attr,
&lustre_sattr_bulk_timeout.u.attr,
+ &lustre_attr_no_transno.attr,
#endif
&lustre_sattr_lbug_on_eviction.u.attr,
NULL,
.release = seq_release,
};
+/* checksum_speed */
+static void *checksum_speed_start(struct seq_file *p, loff_t *pos)
+{
+ return pos;
+}
+
+static void checksum_speed_stop(struct seq_file *p, void *v)
+{
+}
+
+static void *checksum_speed_next(struct seq_file *p, void *v, loff_t *pos)
+{
+ ++(*pos);
+ if (*pos >= CFS_HASH_ALG_SPEED_MAX - 1)
+ return NULL;
+
+ return pos;
+}
+
+static int checksum_speed_show(struct seq_file *p, void *v)
+{
+ loff_t index = *(loff_t *)v;
+
+ if (!index || index > CFS_HASH_ALG_SPEED_MAX - 1)
+ return 0;
+
+ seq_printf(p, "%s: %d\n", cfs_crypto_hash_name(index),
+ cfs_crypto_hash_speeds[index]);
+
+ return 0;
+}
+
+static const struct seq_operations checksum_speed_sops = {
+ .start = checksum_speed_start,
+ .stop = checksum_speed_stop,
+ .next = checksum_speed_next,
+ .show = checksum_speed_show,
+};
+
+static int checksum_speed_open(struct inode *inode, struct file *file)
+{
+ int rc = seq_open(file, &checksum_speed_sops);
+
+ if (rc)
+ return rc;
+
+ return 0;
+}
+
+static const struct file_operations checksum_speed_fops = {
+ .owner = THIS_MODULE,
+ .open = checksum_speed_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static int
health_check_seq_show(struct seq_file *m, void *unused)
{
}
debugfs_lustre_root = debugfs_create_dir("lustre", NULL);
- if (IS_ERR_OR_NULL(debugfs_lustre_root)) {
- rc = debugfs_lustre_root ? PTR_ERR(debugfs_lustre_root)
- : -ENOMEM;
- debugfs_lustre_root = NULL;
- kset_unregister(lustre_kset);
- goto out;
- }
file = debugfs_create_file("devices", 0444, debugfs_lustre_root, NULL,
&obd_device_list_fops);
- if (IS_ERR_OR_NULL(file)) {
- rc = file ? PTR_ERR(file) : -ENOMEM;
- debugfs_remove(debugfs_lustre_root);
- kset_unregister(lustre_kset);
- goto out;
- }
file = debugfs_create_file("health_check", 0444, debugfs_lustre_root,
NULL, &health_check_fops);
- if (IS_ERR_OR_NULL(file)) {
- rc = file ? PTR_ERR(file) : -ENOMEM;
- debugfs_remove_recursive(debugfs_lustre_root);
- kset_unregister(lustre_kset);
- goto out;
- }
+
+ file = debugfs_create_file("checksum_speed", 0444, debugfs_lustre_root,
+ NULL, &checksum_speed_fops);
entry = lprocfs_register("fs/lustre", NULL, NULL, NULL);
if (IS_ERR(entry)) {