mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-16 09:46:55 +00:00
btrfs-progs: use hash wrapper for crc32c in btrfs_csum_data
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ebb79f1644
commit
8c5756ec8d
@ -141,15 +141,11 @@ static void print_tree_block_error(struct btrfs_fs_info *fs_info,
|
|||||||
|
|
||||||
int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len)
|
int btrfs_csum_data(u16 csum_type, const u8 *data, u8 *out, size_t len)
|
||||||
{
|
{
|
||||||
u32 crc = ~(u32)0;
|
|
||||||
|
|
||||||
memset(out, 0, BTRFS_CSUM_SIZE);
|
memset(out, 0, BTRFS_CSUM_SIZE);
|
||||||
|
|
||||||
switch (csum_type) {
|
switch (csum_type) {
|
||||||
case BTRFS_CSUM_TYPE_CRC32:
|
case BTRFS_CSUM_TYPE_CRC32:
|
||||||
crc = crc32c(crc, data, len);
|
return hash_crc32c(data, len, out);
|
||||||
put_unaligned_le32(~crc, out);
|
|
||||||
return 0;
|
|
||||||
case BTRFS_CSUM_TYPE_XXHASH:
|
case BTRFS_CSUM_TYPE_XXHASH:
|
||||||
return hash_xxhash(data, len, out);
|
return hash_xxhash(data, len, out);
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user