Commit 4bb3c2e2 authored by Johannes Thumshirn's avatar Johannes Thumshirn Committed by David Sterba

btrfs: use btrfs_crc32c{,_final}() in for free space cache

The CRC checksum in the free space cache is not dependant on the super
block's csum_type field but always a CRC32C.

So use btrfs_crc32c() and btrfs_crc32c_final() instead of
btrfs_csum_data() and btrfs_csum_final() for computing these checksums.
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 65019df8
...@@ -465,9 +465,8 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index) ...@@ -465,9 +465,8 @@ static void io_ctl_set_crc(struct btrfs_io_ctl *io_ctl, int index)
if (index == 0) if (index == 0)
offset = sizeof(u32) * io_ctl->num_pages; offset = sizeof(u32) * io_ctl->num_pages;
crc = btrfs_csum_data(io_ctl->orig + offset, crc, crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
PAGE_SIZE - offset); btrfs_crc32c_final(crc, (u8 *)&crc);
btrfs_csum_final(crc, (u8 *)&crc);
io_ctl_unmap_page(io_ctl); io_ctl_unmap_page(io_ctl);
tmp = page_address(io_ctl->pages[0]); tmp = page_address(io_ctl->pages[0]);
tmp += index; tmp += index;
...@@ -493,9 +492,8 @@ static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index) ...@@ -493,9 +492,8 @@ static int io_ctl_check_crc(struct btrfs_io_ctl *io_ctl, int index)
val = *tmp; val = *tmp;
io_ctl_map_page(io_ctl, 0); io_ctl_map_page(io_ctl, 0);
crc = btrfs_csum_data(io_ctl->orig + offset, crc, crc = btrfs_crc32c(crc, io_ctl->orig + offset, PAGE_SIZE - offset);
PAGE_SIZE - offset); btrfs_crc32c_final(crc, (u8 *)&crc);
btrfs_csum_final(crc, (u8 *)&crc);
if (val != crc) { if (val != crc) {
btrfs_err_rl(io_ctl->fs_info, btrfs_err_rl(io_ctl->fs_info,
"csum mismatch on free space cache"); "csum mismatch on free space cache");
......
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