]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: don't assume ordered sums to be 4 bytes
authorJohannes Thumshirn <jthumshirn@suse.de>
Wed, 22 May 2019 08:19:01 +0000 (10:19 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 1 Jul 2019 11:35:00 +0000 (13:35 +0200)
commitf48c562a06c018835a7877fd6c43062be867edf9
treeff9d51c831b177b75d4abd939159a8341883edcb
parent86e22444650c5b62a9e6d0d6a45d64173c901ecb
btrfs: don't assume ordered sums to be 4 bytes

BTRFS has the implicit assumption that a checksum in btrfs_orderd_sums
is 4 bytes. While this is true for CRC32C, it is not for any other
checksum.

Change the data type to be a byte array and adjust loop index
calculation accordingly.

This includes moving the adjustment of 'index' by 'ins_size' in
btrfs_csum_file_blocks() before dividing 'ins_size' by the checksum
size, because before this patch the 'sums' member of 'struct
btrfs_ordered_sum' was 4 Bytes in size and afterwards it is only one
byte.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/ctree.h
fs/btrfs/file-item.c
fs/btrfs/ordered-data.c
fs/btrfs/ordered-data.h
fs/btrfs/scrub.c