btrfs: fix fast csum implementation detection
authorChristoph Hellwig <hch@lst.de>
Wed, 29 Mar 2023 00:13:05 +0000 (09:13 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:06 +0000 (12:35 +0200)
commit874cf0b2c0a885078164062a9f9a9f0c044aadbf
tree9c033e20d3df58833ae3eacad0e1e54f2e38a3b2
parent3103c0781257e2955ca1e05e108e42425a1ef986
btrfs: fix fast csum implementation detection

commit 68d99ab0e9221ef54506f827576c5a914680eeaf upstream.

The BTRFS_FS_CSUM_IMPL_FAST flag is currently set whenever a non-generic
crc32c is detected, which is the incorrect check if the file system uses
a different checksumming algorithm.  Refactor the code to only check
this if crc32c is actually used.  Note that in an ideal world the
information if an algorithm is hardware accelerated or not should be
provided by the crypto API instead, but that's left for another day.

CC: stable@vger.kernel.org # 5.4.x: c8a5f8ca9a9c: btrfs: print checksum type and implementation at mount time
CC: stable@vger.kernel.org # 5.4.x
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/disk-io.c
fs/btrfs/super.c