diff options
Diffstat (limited to 'fs/btrfs/btrfs_inode.h')
| -rw-r--r-- | fs/btrfs/btrfs_inode.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index d5b438706b77..f853835c409c 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h | |||
| @@ -337,22 +337,34 @@ static inline void btrfs_inode_resume_unlocked_dio(struct btrfs_inode *inode) | |||
| 337 | clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, &inode->runtime_flags); | 337 | clear_bit(BTRFS_INODE_READDIO_NEED_LOCK, &inode->runtime_flags); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | /* Array of bytes with variable length, hexadecimal format 0x1234 */ | ||
| 341 | #define CSUM_FMT "0x%*phN" | ||
| 342 | #define CSUM_FMT_VALUE(size, bytes) size, bytes | ||
| 343 | |||
| 340 | static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, | 344 | static inline void btrfs_print_data_csum_error(struct btrfs_inode *inode, |
| 341 | u64 logical_start, u32 csum, u32 csum_expected, int mirror_num) | 345 | u64 logical_start, u8 *csum, u8 *csum_expected, int mirror_num) |
| 342 | { | 346 | { |
| 343 | struct btrfs_root *root = inode->root; | 347 | struct btrfs_root *root = inode->root; |
| 348 | struct btrfs_super_block *sb = root->fs_info->super_copy; | ||
| 349 | const u16 csum_size = btrfs_super_csum_size(sb); | ||
| 344 | 350 | ||
| 345 | /* Output minus objectid, which is more meaningful */ | 351 | /* Output minus objectid, which is more meaningful */ |
| 346 | if (root->root_key.objectid >= BTRFS_LAST_FREE_OBJECTID) | 352 | if (root->root_key.objectid >= BTRFS_LAST_FREE_OBJECTID) |
| 347 | btrfs_warn_rl(root->fs_info, | 353 | btrfs_warn_rl(root->fs_info, |
| 348 | "csum failed root %lld ino %lld off %llu csum 0x%08x expected csum 0x%08x mirror %d", | 354 | "csum failed root %lld ino %lld off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d", |
| 349 | root->root_key.objectid, btrfs_ino(inode), | 355 | root->root_key.objectid, btrfs_ino(inode), |
| 350 | logical_start, csum, csum_expected, mirror_num); | 356 | logical_start, |
| 357 | CSUM_FMT_VALUE(csum_size, csum), | ||
| 358 | CSUM_FMT_VALUE(csum_size, csum_expected), | ||
| 359 | mirror_num); | ||
| 351 | else | 360 | else |
| 352 | btrfs_warn_rl(root->fs_info, | 361 | btrfs_warn_rl(root->fs_info, |
| 353 | "csum failed root %llu ino %llu off %llu csum 0x%08x expected csum 0x%08x mirror %d", | 362 | "csum failed root %llu ino %llu off %llu csum " CSUM_FMT " expected csum " CSUM_FMT " mirror %d", |
| 354 | root->root_key.objectid, btrfs_ino(inode), | 363 | root->root_key.objectid, btrfs_ino(inode), |
| 355 | logical_start, csum, csum_expected, mirror_num); | 364 | logical_start, |
| 365 | CSUM_FMT_VALUE(csum_size, csum), | ||
| 366 | CSUM_FMT_VALUE(csum_size, csum_expected), | ||
| 367 | mirror_num); | ||
| 356 | } | 368 | } |
| 357 | 369 | ||
| 358 | #endif | 370 | #endif |
