btrfs: remove assumption about csum type form btrfs_print_data_csum_error()
btrfs_print_data_csum_error() still assumed checksums to be 32 bit in size. Make it size agnostic. 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>
This commit is contained in:
parent
d5178578bc
commit
ea41d6b278
|
@ -342,7 +342,7 @@ static inline void btrfs_inode_resume_unlocked_dio(struct btrfs_inode *inode)
|
||||||
#define CSUM_FMT_VALUE(size, bytes) size, bytes
|
#define CSUM_FMT_VALUE(size, bytes) size, bytes
|
||||||
|
|
||||||
static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode,
|
static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode,
|
||||||
u64 logical_start, u32 csum, u32 csum_expected, int mirror_num)
|
u64 logical_start, u8 *csum, u8 *csum_expected, int mirror_num)
|
||||||
{
|
{
|
||||||
struct btrfs_root *root = inode->root;
|
struct btrfs_root *root = inode->root;
|
||||||
struct btrfs_super_block *sb = root->fs_info->super_copy;
|
struct btrfs_super_block *sb = root->fs_info->super_copy;
|
||||||
|
@ -354,16 +354,16 @@ static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode,
|
||||||
"csum failed root %lld ino %lld off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
"csum failed root %lld ino %lld off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
||||||
root->root_key.objectid, btrfs_ino(inode),
|
root->root_key.objectid, btrfs_ino(inode),
|
||||||
logical_start,
|
logical_start,
|
||||||
CSUM_FMT_VALUE(csum_size, &csum),
|
CSUM_FMT_VALUE(csum_size, csum),
|
||||||
CSUM_FMT_VALUE(csum_size, &csum_expected),
|
CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||||
mirror_num);
|
mirror_num);
|
||||||
else
|
else
|
||||||
btrfs_warn_rl(root->fs_info,
|
btrfs_warn_rl(root->fs_info,
|
||||||
"csum failed root %llu ino %llu off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
"csum failed root %llu ino %llu off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d",
|
||||||
root->root_key.objectid, btrfs_ino(inode),
|
root->root_key.objectid, btrfs_ino(inode),
|
||||||
logical_start,
|
logical_start,
|
||||||
CSUM_FMT_VALUE(csum_size, &csum),
|
CSUM_FMT_VALUE(csum_size, csum),
|
||||||
CSUM_FMT_VALUE(csum_size, &csum_expected),
|
CSUM_FMT_VALUE(csum_size, csum_expected),
|
||||||
mirror_num);
|
mirror_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,7 @@ static int check_compressed_csum(struct btrfs_inode *inode,
|
||||||
|
|
||||||
if (memcmp(&csum, cb_sum, csum_size)) {
|
if (memcmp(&csum, cb_sum, csum_size)) {
|
||||||
btrfs_print_data_csum_error(inode, disk_start,
|
btrfs_print_data_csum_error(inode, disk_start,
|
||||||
*(u32 *)csum, *(u32 *)cb_sum,
|
csum, cb_sum, cb->mirror_num);
|
||||||
cb->mirror_num);
|
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3225,8 +3225,8 @@ static int __readpage_endio_check(struct inode *inode,
|
||||||
kunmap_atomic(kaddr);
|
kunmap_atomic(kaddr);
|
||||||
return 0;
|
return 0;
|
||||||
zeroit:
|
zeroit:
|
||||||
btrfs_print_data_csum_error(BTRFS_I(inode), start, *(u32 *)csum,
|
btrfs_print_data_csum_error(BTRFS_I(inode), start, csum, csum_expected,
|
||||||
*(u32 *)csum_expected, io_bio->mirror_num);
|
io_bio->mirror_num);
|
||||||
memset(kaddr + pgoff, 1, len);
|
memset(kaddr + pgoff, 1, len);
|
||||||
flush_dcache_page(page);
|
flush_dcache_page(page);
|
||||||
kunmap_atomic(kaddr);
|
kunmap_atomic(kaddr);
|
||||||
|
|
Loading…
Reference in New Issue