Skip to contentSkip to conversation

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

PATCH Jeff Mahoney 1 participant 1 message Sep 16, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

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.

---
 fs/btrfs/hash.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/btrfs/hash.c +5 -1
@@ -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)
Signature · 2 lines
Jeff Mahoney
SUSE Labs