From: Eric Biggers <ebiggers@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: linux-crypto@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
linux-btrfs@vger.kernel.org,
Alexander Gordeev <agordeev@linux.ibm.com>,
Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Subject: [PATCH 1/2] btrfs: stop parsing crc32c driver name
Date: Fri, 13 Jun 2025 11:37:52 -0700 [thread overview]
Message-ID: <20250613183753.31864-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20250613183753.31864-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
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 patch.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
fs/btrfs/disk-io.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1beb9458f622a..7bb453b69639c 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2024,18 +2024,14 @@ static int btrfs_init_csum_hash(struct btrfs_fs_info *fs_info, u16 csum_type)
return PTR_ERR(csum_shash);
}
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:
set_bit(BTRFS_FS_CSUM_IMPL_FAST, &fs_info->flags);
break;
--
2.49.0
next prev parent reply other threads:[~2025-06-13 18:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-13 18:37 [PATCH 0/2] Simplify the shash wrappers for the CRC32 library Eric Biggers
2025-06-13 18:37 ` Eric Biggers [this message]
2025-06-13 18:37 ` [PATCH 2/2] crypto/crc32[c]: register only "-lib" drivers Eric Biggers
2025-06-17 20:17 ` David Sterba
2025-06-17 20:20 ` Eric Biggers
2025-06-17 20:47 ` Eric Biggers
2025-06-18 8:58 ` David Sterba
2025-06-19 10:27 ` Daniel Vacek
2025-06-19 12:59 ` David Sterba
2025-06-17 3:39 ` [PATCH 0/2] Simplify the shash wrappers for the CRC32 library Eric Biggers
2025-06-17 20:19 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250613183753.31864-2-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®