X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fobd_sysfs.c;h=5d9430a0930e9a0c4a4193a4636a1dca7b5680d0;hb=f7f31f8f969f410cca0b4b8b02f81391148e01f2;hp=a468fab59f3bdcfd36a9427b5b7e6a824a96283f;hpb=a03765b2da70fb9242a622aba3ca4363a63fa656;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/obd_sysfs.c b/lustre/obdclass/obd_sysfs.c index a468fab..5d9430a 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 @@ -501,6 +501,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) { @@ -593,6 +650,9 @@ int class_procfs_init(void) file = debugfs_create_file("health_check", 0444, debugfs_lustre_root, NULL, &health_check_fops); + 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)) { rc = PTR_ERR(entry);