diff options
author | Johannes Thumshirn <jthumshirn@suse.de> | 2019-05-22 10:19:01 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-07-01 13:35:00 +0200 |
commit | 1e25a2e3ca0dab0ed1030570e95d98af47113eae (patch) | |
tree | ff9d51c831b177b75d4abd939159a8341883edcb /fs/btrfs/compression.c | |
parent | 4bb3c2e2b5bb0d57f7d11f2da829357c5ca628a4 (diff) | |
download | lwn-1e25a2e3ca0dab0ed1030570e95d98af47113eae.tar.gz lwn-1e25a2e3ca0dab0ed1030570e95d98af47113eae.zip |
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>
Diffstat (limited to 'fs/btrfs/compression.c')
-rw-r--r-- | fs/btrfs/compression.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 84dd4a8980c5..a8e551ca8798 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -631,7 +631,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) { ret = btrfs_lookup_bio_sums(inode, comp_bio, - sums); + (u8 *)sums); BUG_ON(ret); /* -ENOMEM */ } sums += DIV_ROUND_UP(comp_bio->bi_iter.bi_size, @@ -657,7 +657,7 @@ blk_status_t btrfs_submit_compressed_read(struct inode *inode, struct bio *bio, BUG_ON(ret); /* -ENOMEM */ if (!(BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)) { - ret = btrfs_lookup_bio_sums(inode, comp_bio, sums); + ret = btrfs_lookup_bio_sums(inode, comp_bio, (u8 *) sums); BUG_ON(ret); /* -ENOMEM */ } |