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 <[email protected]>
---
 fs/btrfs/hash.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- 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)

-- 
Jeff Mahoney
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to