The failed csum messages generated by btrfs mention the inode number, but on filesystems with multiple subvolumes, that's not enough to identify the file. I've added the inode number to the messages so that they're more complete. I also noticed that the extent/offset information printed for the file isn't always correct. Indeed, when we print an offset that could be fed to inspect-internal logical-resolve, we used the term offset, that doesn't make it clear it's a logical offset, whereas when we print a physical disk offset, as in compression.c, we used the term extent, which incorrectly implied it to be a logical offset. I've renamed them to lofst and phofst, which are hopefully clearer. Ideally, we'd uniformly print logical offsets in these messages, but presumably the information isn't readily available for check_compressed_csum. I haven't quite tested this beyond building it (I don't have a sure way to trigger csum errors :-), but AFAICT the objectid I've added is the same number that one can pass to mount as subvolid, or look up in the btrfs subvol list table. Signed-off-by: Alexandre Oliva <oliva@gnu.org> --- fs/btrfs/compression.c | 8 +++++--- fs/btrfs/inode.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index b01fb6c..9f095b3 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -129,9 +129,11 @@ static int check_compressed_csum(struct inode *inode, if (csum != *cb_sum) { btrfs_info(BTRFS_I(inode)->root->fs_info, - "csum failed ino %llu extent %llu csum %u wanted %u mirror %d", - btrfs_ino(inode), disk_start, csum, *cb_sum, - cb->mirror_num); + "csum failed ino %llu vol %llu phofst %llu csum %u wanted %u mirror %d", + btrfs_ino(inode), + BTRFS_I(inode)->root->root_key.objectid, + disk_start, csum, *cb_sum, + cb->mirror_num); ret = -EIO; goto fail; } diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index d3d4448..cc32b84 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2829,8 +2829,10 @@ good: zeroit: if (__ratelimit(&_rs)) - btrfs_info(root->fs_info, "csum failed ino %llu off %llu csum %u expected csum %u", - btrfs_ino(page->mapping->host), start, csum, csum_expected); + btrfs_info(root->fs_info, "csum failed ino %llu vol %llu lofst %llu csum %u expected csum %u", + btrfs_ino(page->mapping->host), + root->root_key.objectid, + start, csum, csum_expected); memset(kaddr + offset, 1, end - start + 1); flush_dcache_page(page); kunmap_atomic(kaddr); @@ -6981,8 +6983,10 @@ static void btrfs_endio_direct_read(struct bio *bio, int err) flush_dcache_page(bvec->bv_page); if (csum != csums[i]) { - btrfs_err(root->fs_info, "csum failed ino %llu off %llu csum %u expected csum %u", - btrfs_ino(inode), start, csum, + btrfs_err(root->fs_info, "csum failed ino %llu vol %llu lofst %llu csum %u expected csum %u", + btrfs_ino(inode), + root->root_key.objectid, + start, csum, csums[i]); err = -EIO; } -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html