btrfs: detect fast implementation of crc32c on all architectures
authorDavid Sterba <dsterba@suse.com>
Thu, 16 May 2019 11:39:59 +0000 (13:39 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 1 Jul 2019 11:34:53 +0000 (13:34 +0200)
commit9b4e675a9978800995f83af0ed90e890ca501f31
tree4a24a502eddfcfa47903ec366aa36e89d5722eef
parent78192442d383fb47ff5fa066f23c1d1bd382e526
btrfs: detect fast implementation of crc32c on all architectures

Currently, there's only check for fast crc32c implementation on X86,
based on the CPU flags. This is used to decide if checksumming should be
offloaded to worker threads or can be calculated by the caller.

As there are more architectures that implement a faster version of
crc32c (ARM, SPARC, s390, MIPS, PowerPC), also there are specialized hw
cards.

The detection is based on driver name, all generic C implementations
contain 'generic', while the specialized versions do not. Alternatively
the priority could be used, but this is not currently provided by the
crypto API.

The flag is set per-filesystem at mount time and used for the offloading
decisions.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/super.c