aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Dilger <[email protected]>2016-03-26 15:40:56 -0400
committerGreg Kroah-Hartman <[email protected]>2016-03-29 12:06:51 -0700
commit1bc55f796a9872208e19b57fd00f4c484be35318 (patch)
tree43219252cbe25fc1dabe5386c1ad201b69da9aa6
parent78675cb1abec09f1c93f53457b4f7859273d8d0a (diff)
staging: lustre: libcfs: calculate crypto performance using pages
Use alloc_page() and use cfs_crypto_hash_update_page() to compute the hash instead of cfs_crypto_hash_digest(), since tgt_checksum_bulk() computes the hash by page anyway. Signed-off-by: Andreas Dilger <[email protected]> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5279 Reviewed-on: http://review.whamcloud.com/10982 Reviewed-by: John L. Hammond <[email protected]> Reviewed-by: James Simmons <[email protected]> Reviewed-by: Alexander Boyko <[email protected]> Reviewed-by: Bob Glossman <[email protected]> Reviewed-by: Oleg Drokin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
index aec79165b5c7..f8383dc430a5 100644
--- a/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
+++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-crypto.c
@@ -330,8 +330,23 @@ static void cfs_crypto_performance_test(enum cfs_crypto_hash_alg hash_alg)
for (start = jiffies, end = start + sec * HZ, bcount = 0;
time_before(jiffies, end); bcount++) {
- err = cfs_crypto_hash_digest(hash_alg, buf, buf_len, NULL, 0,
- hash, &hash_len);
+ struct cfs_crypto_hash_desc *hdesc;
+ int i;
+
+ hdesc = cfs_crypto_hash_init(hash_alg, NULL, 0);
+ if (IS_ERR(hdesc)) {
+ err = PTR_ERR(hdesc);
+ break;
+ }
+
+ for (i = 0; i < buf_len / PAGE_SIZE; i++) {
+ err = cfs_crypto_hash_update_page(hdesc, page, 0,
+ PAGE_SIZE);
+ if (err)
+ break;
+ }
+
+ err = cfs_crypto_hash_final(hdesc, hash, &hash_len);
if (err)
break;
}