瀏覽代碼

btrfs: advertise which crc32c implementation is being used at module load

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>
[ added a helper and used in module load-time message ]
Signed-off-by: David Sterba <dsterba@suse.com>
Jeff Mahoney 10 年之前
父節點
當前提交
5f9e1059d9
共有 3 個文件被更改,包括 9 次插入2 次删除
  1. 5 0
      fs/btrfs/hash.c
  2. 1 0
      fs/btrfs/hash.h
  3. 3 2
      fs/btrfs/super.c

+ 5 - 0
fs/btrfs/hash.c

@@ -24,6 +24,11 @@ int __init btrfs_hash_init(void)
 	return PTR_ERR_OR_ZERO(tfm);
 	return PTR_ERR_OR_ZERO(tfm);
 }
 }
 
 
+const char* btrfs_crc32c_impl(void)
+{
+	return crypto_tfm_alg_driver_name(crypto_shash_tfm(tfm));
+}
+
 void btrfs_hash_exit(void)
 void btrfs_hash_exit(void)
 {
 {
 	crypto_free_shash(tfm);
 	crypto_free_shash(tfm);

+ 1 - 0
fs/btrfs/hash.h

@@ -22,6 +22,7 @@
 int __init btrfs_hash_init(void);
 int __init btrfs_hash_init(void);
 
 
 void btrfs_hash_exit(void);
 void btrfs_hash_exit(void);
+const char* btrfs_crc32c_impl(void);
 
 
 u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length);
 u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length);
 
 

+ 3 - 2
fs/btrfs/super.c

@@ -2303,7 +2303,7 @@ static void btrfs_interface_exit(void)
 
 
 static void btrfs_print_mod_info(void)
 static void btrfs_print_mod_info(void)
 {
 {
-	printk(KERN_INFO "Btrfs loaded"
+	printk(KERN_INFO "Btrfs loaded, crc32c=%s"
 #ifdef CONFIG_BTRFS_DEBUG
 #ifdef CONFIG_BTRFS_DEBUG
 			", debug=on"
 			", debug=on"
 #endif
 #endif
@@ -2313,7 +2313,8 @@ static void btrfs_print_mod_info(void)
 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
 #ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
 			", integrity-checker=on"
 			", integrity-checker=on"
 #endif
 #endif
-			"\n");
+			"\n",
+			btrfs_crc32c_impl());
 }
 }
 
 
 static int btrfs_run_sanity_tests(void)
 static int btrfs_run_sanity_tests(void)