X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fobd_sysfs.c;h=d6a9a5142741c5b95bb17edbd07069a7394f45e3;hb=2a498f06ccc975fb57214961db6e20a6c1cc2ec7;hp=d79bb63cd8dbca2bc1f0bd71b8abd39a15c25904;hpb=6706bfa81998c999012909e4cfcd1d3dbc347075;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/obd_sysfs.c b/lustre/obdclass/obd_sysfs.c index d79bb63..d6a9a51 100644 --- a/lustre/obdclass/obd_sysfs.c +++ b/lustre/obdclass/obd_sysfs.c @@ -27,7 +27,6 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * lustre/obdclass/obd_sysfs.c * @@ -63,6 +62,7 @@ #include #include +#include #include #include #include @@ -112,7 +112,6 @@ static struct static_lustre_uintvalue_attr lustre_sattr_##name = \ { __ATTR(name, 0644, static_uintvalue_show, \ static_uintvalue_store), value } -LUSTRE_STATIC_UINT_ATTR(timeout, &obd_timeout); LUSTRE_STATIC_UINT_ATTR(debug_peer_on_timeout, &obd_debug_peer_on_timeout); LUSTRE_STATIC_UINT_ATTR(dump_on_timeout, &obd_dump_on_timeout); LUSTRE_STATIC_UINT_ATTR(dump_on_eviction, &obd_dump_on_eviction); @@ -121,7 +120,10 @@ LUSTRE_STATIC_UINT_ATTR(at_max, &at_max); LUSTRE_STATIC_UINT_ATTR(at_extra, &at_extra); LUSTRE_STATIC_UINT_ATTR(at_early_margin, &at_early_margin); LUSTRE_STATIC_UINT_ATTR(at_history, &at_history); +LUSTRE_STATIC_UINT_ATTR(enable_stats_header, &obd_enable_stats_header); LUSTRE_STATIC_UINT_ATTR(lbug_on_eviction, &obd_lbug_on_eviction); +LUSTRE_STATIC_UINT_ATTR(ping_interval, &ping_interval); +LUSTRE_STATIC_UINT_ATTR(evict_multiplier, &ping_evict_timeout_multiplier); #ifdef HAVE_SERVER_SUPPORT LUSTRE_STATIC_UINT_ATTR(ldlm_timeout, &ldlm_timeout); @@ -214,7 +216,7 @@ static ssize_t version_show(struct kobject *kobj, struct attribute *attr, 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"; @@ -252,6 +254,9 @@ health_check_show(struct kobject *kobj, struct attribute *attr, char *buf) if (obd->obd_stopping) continue; + if (obd->obd_read_only) + continue; + class_incref(obd, __func__, current); read_unlock(&obd_dev_lock); @@ -280,7 +285,7 @@ static ssize_t jobid_var_show(struct kobject *kobj, struct attribute *attr, 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; } @@ -307,7 +312,7 @@ static ssize_t jobid_name_show(struct kobject *kobj, struct attribute *attr, 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; } @@ -349,7 +354,7 @@ static ssize_t jobid_this_session_show(struct kobject *kobj, 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; } @@ -377,6 +382,30 @@ static ssize_t jobid_this_session_store(struct kobject *kobj, return ret ?: count; } +static ssize_t timeout_show(struct kobject *kobj, + struct attribute *attr, + char *buf) +{ + return sprintf(buf, "%u\n", obd_timeout); +} + +static ssize_t timeout_store(struct kobject *kobj, + struct attribute *attr, + const char *buffer, + size_t count) +{ + unsigned int val; + int rc; + + rc = kstrtouint(buffer, 10, &val); + if (rc) + return rc; + obd_timeout = val ?: 1U; + ping_interval = max(obd_timeout / 4, 1U); + + return count; +} + /* Root for /sys/kernel/debug/lustre */ struct dentry *debugfs_lustre_root; EXPORT_SYMBOL_GPL(debugfs_lustre_root); @@ -395,15 +424,17 @@ LUSTRE_RO_ATTR(health_check); LUSTRE_RW_ATTR(jobid_var); LUSTRE_RW_ATTR(jobid_name); LUSTRE_RW_ATTR(jobid_this_session); +LUSTRE_RW_ATTR(timeout); static struct attribute *lustre_attrs[] = { &lustre_attr_version.attr, &lustre_attr_pinger.attr, + &lustre_sattr_enable_stats_header.u.attr, &lustre_attr_health_check.attr, &lustre_attr_jobid_name.attr, &lustre_attr_jobid_var.attr, &lustre_attr_jobid_this_session.attr, - &lustre_sattr_timeout.u.attr, + &lustre_attr_timeout.attr, &lustre_attr_max_dirty_mb.attr, &lustre_sattr_debug_peer_on_timeout.u.attr, &lustre_sattr_dump_on_timeout.u.attr, @@ -421,6 +452,8 @@ static struct attribute *lustre_attrs[] = { &lustre_attr_no_transno.attr, #endif &lustre_sattr_lbug_on_eviction.u.attr, + &lustre_sattr_ping_interval.u.attr, + &lustre_sattr_evict_multiplier.u.attr, NULL, }; @@ -501,6 +534,63 @@ static const struct file_operations obd_device_list_fops = { .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) { @@ -586,31 +676,15 @@ int class_procfs_init(void) } 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)) {