diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2017-02-09 10:45:06 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-02-17 12:03:48 +0100 |
commit | 6f6b643e44ef79cbd85e69800a06326805829aa8 (patch) | |
tree | 7d04cfdabebaa9da49fc5f36c83024e7d882fbb7 /fs/btrfs/btrfs_inode.h | |
parent | fe01aa65385c226d822013b90608b67c485f8dc6 (diff) | |
download | linux-stable-6f6b643e44ef79cbd85e69800a06326805829aa8.tar.gz linux-stable-6f6b643e44ef79cbd85e69800a06326805829aa8.tar.bz2 linux-stable-6f6b643e44ef79cbd85e69800a06326805829aa8.zip |
btrfs: Better csum error message for data csum mismatch
The original csum error message only outputs inode number, offset, check
sum and expected check sum.
However no root objectid is outputted, which sometimes makes debugging
quite painful under multi-subvolume case (including relocation).
Also the checksum output is decimal, which seldom makes sense for
users/developers and is hard to read in most time.
This patch will add root objectid, which will be %lld for rootid larger
than LAST_FREE_OBJECTID, and hex csum output for better readability.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/btrfs_inode.h')
-rw-r--r-- | fs/btrfs/btrfs_inode.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h index b2dde0efebc0..819a6d27218a 100644 --- a/fs/btrfs/btrfs_inode.h +++ b/fs/btrfs/btrfs_inode.h @@ -324,6 +324,24 @@ static inline void btrfs_inode_resume_unlocked_dio(struct inode *inode) &BTRFS_I(inode)->runtime_flags); } +static inline void btrfs_print_data_csum_error(struct inode *inode, + u64 logical_start, u32 csum, u32 csum_expected, int mirror_num) +{ + struct btrfs_root *root = BTRFS_I(inode)->root; + + /* Output minus objectid, which is more meaningful */ + if (root->objectid >= BTRFS_LAST_FREE_OBJECTID) + btrfs_warn_rl(root->fs_info, + "csum failed root %lld ino %lld off %llu csum 0x%08x expected csum 0x%08x mirror %d", + root->objectid, btrfs_ino(BTRFS_I(inode)), + logical_start, csum, csum_expected, mirror_num); + else + btrfs_warn_rl(root->fs_info, + "csum failed root %llu ino %llu off %llu csum 0x%08x expected csum 0x%08x mirror %d", + root->objectid, btrfs_ino(BTRFS_I(inode)), + logical_start, csum, csum_expected, mirror_num); +} + bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end); #endif |