[PATCH[ btrfs: advertise which crc32c implementation is being used on mount
diff mbox

Message ID 55F96FFD.5040501@suse.com
State New
Headers show

Commit Message

Jeff Mahoney Sept. 16, 2015, 1:34 p.m. UTC
Since several architectures support hardware-accelerated crc32c 
calculation, it would be nice to confirm that btrfs is actually using it.

We can see an elevated use count for the module, but it doesn't actually
show who the users are.  This patch simply prints the name of the driver
after successfully initializing the shash.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/btrfs/hash.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch
diff mbox

--- a/fs/btrfs/hash.c
+++ b/fs/btrfs/hash.c
@@ -20,8 +20,12 @@  static struct crypto_shash *tfm;
 int __init btrfs_hash_init(void)
 {
 	tfm = crypto_alloc_shash("crc32c", 0, 0);
+	if (IS_ERR(tfm))
+		return PTR_ERR(tfm);
 
-	return PTR_ERR_OR_ZERO(tfm);
+	printk("BTRFS: using %s for crc32c\n",
+	       crypto_tfm_alg_driver_name(crypto_shash_tfm(tfm)));
+	return 0;
 }
 
 void btrfs_hash_exit(void)