Skip to content

Commit

Permalink
btrfs: tree-checker: Enhance output for check_csum_item
Browse files Browse the repository at this point in the history
Output the bad value and expected good value (or its alignment).

Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
[ unindent long strings ]
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Qu Wenruo authored and David Sterba committed Oct 30, 2017
1 parent 478d01b commit d508c5f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fs/btrfs/tree-checker.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,21 @@ static int check_csum_item(struct btrfs_root *root, struct extent_buffer *leaf,
u32 csumsize = btrfs_super_csum_size(root->fs_info->super_copy);

if (key->objectid != BTRFS_EXTENT_CSUM_OBJECTID) {
CORRUPT("invalid objectid for csum item", leaf, root, slot);
generic_err(root, leaf, slot,
"invalid key objectid for csum item, have %llu expect %llu",
key->objectid, BTRFS_EXTENT_CSUM_OBJECTID);
return -EUCLEAN;
}
if (!IS_ALIGNED(key->offset, sectorsize)) {
CORRUPT("unaligned key offset for csum item", leaf, root, slot);
generic_err(root, leaf, slot,
"unaligned key offset for csum item, have %llu should be aligned to %u",
key->offset, sectorsize);
return -EUCLEAN;
}
if (!IS_ALIGNED(btrfs_item_size_nr(leaf, slot), csumsize)) {
CORRUPT("unaligned csum item size", leaf, root, slot);
generic_err(root, leaf, slot,
"unaligned item size for csum item, have %u should be aligned to %u",
btrfs_item_size_nr(leaf, slot), csumsize);
return -EUCLEAN;
}
return 0;
Expand Down

0 comments on commit d508c5f

Please sign in to comment.