Commit 5852c8b9 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by David Sterba

btrfs: use btrfs_csum_data() instead of directly calling crc32c

btrfsic_test_for_metadata() directly calls the crc32c() library function
for calculating the CRC32C checksum, but then uses btrfs_csum_final() to
invert the result.

To ease further refactoring and development around checksumming in BTRFS
convert to calling btrfs_csum_data(), which is a wrapper around
crc32c().
Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent a94d1d0c
...@@ -1728,7 +1728,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state, ...@@ -1728,7 +1728,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state,
size_t sublen = i ? PAGE_SIZE : size_t sublen = i ? PAGE_SIZE :
(PAGE_SIZE - BTRFS_CSUM_SIZE); (PAGE_SIZE - BTRFS_CSUM_SIZE);
crc = crc32c(crc, data, sublen); crc = btrfs_csum_data(data, crc, sublen);
} }
btrfs_csum_final(crc, csum); btrfs_csum_final(crc, csum);
if (memcmp(csum, h->csum, state->csum_size)) if (memcmp(csum, h->csum, state->csum_size))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment