@@ -59,6 +59,7 @@
#include <linux/seq_file.h>
#include <linux/kobject.h>
+#include <linux/libcfs/libcfs_crypto.h>
#include <uapi/linux/lnet/lnetctl.h>
#include <obd_support.h>
#include <obd_class.h>
@@ -420,6 +421,63 @@ static int obd_device_list_open(struct inode *inode, struct file *file)
.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)
{
@@ -507,6 +565,9 @@ int class_procfs_init(void)
debugfs_create_file("health_check", 0444, debugfs_lustre_root,
NULL, &health_check_fops);
+
+ debugfs_create_file("checksum_speed", 0444, debugfs_lustre_root,
+ NULL, &checksum_speed_fops);
out:
return rc;
}
@@ -135,6 +135,9 @@ enum cfs_crypto_hash_alg {
return NULL;
}
+/* Array of hash algorithm speed in MByte per second */
+extern int cfs_crypto_hash_speeds[CFS_HASH_ALG_MAX];
+
/**
* Return hash name for hash algorithm identifier
*
@@ -39,7 +39,8 @@
/**
* Array of hash algorithm speed in MByte per second
*/
-static int cfs_crypto_hash_speeds[CFS_HASH_ALG_MAX];
+int cfs_crypto_hash_speeds[CFS_HASH_ALG_MAX];
+EXPORT_SYMBOL(cfs_crypto_hash_speeds);
/**
* Initialize the state descriptor for the specified hash algorithm.