]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: stop parsing crc32c driver name
authorEric Biggers <ebiggers@kernel.org>
Fri, 13 Jun 2025 18:37:52 +0000 (11:37 -0700)
committerEric Biggers <ebiggers@kernel.org>
Mon, 30 Jun 2025 16:31:56 +0000 (09:31 -0700)
To determine whether the crc32c implementation is "fast", use
crc32_optimizations() instead of parsing the crypto_shash driver name.
This keeps the code working as intended after the driver name is changed
by the next commit.

Acked-by: David Sterba <dsterba@suse.com>
Link: https://lore.kernel.org/r/20250613183753.31864-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
fs/btrfs/disk-io.c

index 0d6ad7512f217c0b0766ce49b413b7d72f7bdb32..3b92431a70fbde232e97b6cecd446659d42d57a4 100644 (file)
@@ -2028,14 +2028,10 @@ static int btrfs_init_csum_hash(struct btrfs_fs_info *fs_info, u16 csum_type)
 
        fs_info->csum_shash = csum_shash;
 
-       /*
-        * Check if the checksum implementation is a fast accelerated one.
-        * As-is this is a bit of a hack and should be replaced once the csum
-        * implementations provide that information themselves.
-        */
+       /* Check if the checksum implementation is a fast accelerated one. */
        switch (csum_type) {
        case BTRFS_CSUM_TYPE_CRC32:
-               if (!strstr(crypto_shash_driver_name(csum_shash), "generic"))
+               if (crc32_optimizations() & CRC32C_OPTIMIZATION)
                        set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags);
                break;
        case BTRFS_CSUM_TYPE_XXHASH: