aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2015-09-16 09:34:53 -0400
committerDavid Sterba <dsterba@suse.com>2016-06-06 08:08:28 -0400
commit5f9e1059d9347191b271bf7d13bd83db57594d2a (patch)
treef23ae20ffd41ac1405e51e75b25e4e19de580179
parente06cd3dd7cea50e87663a88acdfdb7ac1c53a5ca (diff)
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>
-rw-r--r--fs/btrfs/hash.c5
-rw-r--r--fs/btrfs/hash.h1
-rw-r--r--fs/btrfs/super.c5
3 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/hash.c b/fs/btrfs/hash.c
index aae520b2aee5..a97fdc156a03 100644
--- a/fs/btrfs/hash.c
+++ b/fs/btrfs/hash.c
@@ -24,6 +24,11 @@ int __init btrfs_hash_init(void)
24 return PTR_ERR_OR_ZERO(tfm); 24 return PTR_ERR_OR_ZERO(tfm);
25} 25}
26 26
27const char* btrfs_crc32c_impl(void)
28{
29 return crypto_tfm_alg_driver_name(crypto_shash_tfm(tfm));
30}
31
27void btrfs_hash_exit(void) 32void btrfs_hash_exit(void)
28{ 33{
29 crypto_free_shash(tfm); 34 crypto_free_shash(tfm);
diff --git a/fs/btrfs/hash.h b/fs/btrfs/hash.h
index 118a2316e5d3..c3a2ec554361 100644
--- a/fs/btrfs/hash.h
+++ b/fs/btrfs/hash.h
@@ -22,6 +22,7 @@
22int __init btrfs_hash_init(void); 22int __init btrfs_hash_init(void);
23 23
24void btrfs_hash_exit(void); 24void btrfs_hash_exit(void);
25const char* btrfs_crc32c_impl(void);
25 26
26u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length); 27u32 btrfs_crc32c(u32 crc, const void *address, unsigned int length);
27 28
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4e59a91a11e0..4397a303fc6c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2303,7 +2303,7 @@ static void btrfs_interface_exit(void)
2303 2303
2304static void btrfs_print_mod_info(void) 2304static void btrfs_print_mod_info(void)
2305{ 2305{
2306 printk(KERN_INFO "Btrfs loaded" 2306 printk(KERN_INFO "Btrfs loaded, crc32c=%s"
2307#ifdef CONFIG_BTRFS_DEBUG 2307#ifdef CONFIG_BTRFS_DEBUG
2308 ", debug=on" 2308 ", debug=on"
2309#endif 2309#endif
@@ -2313,7 +2313,8 @@ static void btrfs_print_mod_info(void)
2313#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY 2313#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
2314 ", integrity-checker=on" 2314 ", integrity-checker=on"
2315#endif 2315#endif
2316 "\n"); 2316 "\n",
2317 btrfs_crc32c_impl());
2317} 2318}
2318 2319
2319static int btrfs_run_sanity_tests(void) 2320static int btrfs_run_sanity_tests(void)