Commit graph

12 commits

Author SHA1 Message Date
David Sterba 21aa6777b2 btrfs-progs: clean up includes, using include-what-you-use
Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-03 01:11:57 +02:00
David Sterba 4fc291a465 btrfs-progs: fix detection of accelerated implementation.
The build fails with crypto backends other than builtin, the
initializers cannot be reached as they're ifdef-ed out.  Move
hash_init_accel under the right condition and delete the
algorithm-specific initializers as they're used only by the hash test
and that can simply call hash_init_accel to set the implementation.

All the -m flags need to be detected at configure time and the flag used
for ifdef (HAVE_CFLAG_m*), not the actual feature defined by compiler as
the dispatcher function is not built with the -m flags.

The uname check for x86_64 must be dropped so on i386/i586 we can still
build accelerated version.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-03-01 15:10:21 +01:00
David Sterba 140234dc0d btrfs-progs: move include from toplevel directory to include/
In order to reduce number of files in the toplevel directory,

Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 20:11:23 +01:00
David Sterba 8a60fde969 btrfs-progs: crypto: use common CPU feature detection for crc32c
The crc32c selection has been already using the pointer-based approach
so drop the cpuid detection and use our common code for that.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 20:11:22 +01:00
David Sterba bbf703bfd3 btrfs-progs: crypto: call sha256 implementations by pointer
Change how sha256 implementation is selected. Instead of an if-else
check in the block processing function select the best version and assign
the function pointer. This is slightly faster.

At this point the selection is not implemented properly in
hash-speedtest so all results are from the fastest version. This will
be fixed once all algorithms are converted.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 20:10:58 +01:00
David Sterba d1c366ee42 btrfs-progs: crypto: call blake2 implementations by pointer
Change how blake2 implementation is selected. Instead of an if-else check
inside blake2b_compress each time, select the best one and assign the
function pointer. This is slightly faster.

At this point the selection is not implemented properly in
hash-speedtest so all results are from the fastest version. This will
be fixed once all algorithms are converted.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 19:53:43 +01:00
David Sterba 24ec095295 btrfs-progs: crypto: add common function for accelerated initialization
Prepare a single location that will detect or set accelerated versions
of hash algorithms. Right now it's the crc32c, blake2 and sha256 do
an if-else switch while crc32c sets a function pointer.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 19:49:31 +01:00
David Sterba c3ee6a8a09 btrfs-progs: unify GPL header comments
Add the GPL v2 header to files where it was missing and is not from an
external source, update to the most recent version with the address.

Signed-off-by: David Sterba <dsterba@suse.com>
2021-09-07 13:58:44 +02:00
David Sterba 2047b6de3d btrfs-progs: add blake2b support
Add definition, crypto wrappers and support to mkfs for blake2 for
checksumming. There are 2 aliases either blake2 or blake2b.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-18 19:21:06 +01:00
Johannes Thumshirn ae9f8bff30 btrfs-progs: add sha256 as supported checksumming algorithm
Add the definition to the checksum types and let mkfs accept it.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-18 19:20:40 +01:00
David Sterba ebb79f1644 btrfs-progs: add crc32c to hash wrappers
Unify the interface for crc32c too.

Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-18 19:20:03 +01:00
Johannes Thumshirn f070ece2e9 btrfs-progs: add xxhash64 to mkfs
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-11-18 19:20:00 +01:00