Skip to content

Commit 7d410d5

Browse files
fdmananakdave
authored andcommitted
btrfs: make error messages more clear when getting a chunk map
When getting a chunk map, at btrfs_get_chunk_map(), we do some sanity checks to verify we found a chunk map and that map found covers the logical address the caller passed in. However the messages aren't very clear in the sense that don't mention the issue is with a chunk map and one of them prints the 'length' argument as if it were the end offset of the requested range (while the in the string format we use %llu-%llu which suggests a range, and the second %llu-%llu is actually a range for the chunk map). So improve these two details in the error messages. CC: [email protected] # 5.4+ Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 5fba5a5 commit 7d410d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/btrfs/volumes.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,15 +3003,16 @@ struct extent_map *btrfs_get_chunk_map(struct btrfs_fs_info *fs_info,
30033003
read_unlock(&em_tree->lock);
30043004

30053005
if (!em) {
3006-
btrfs_crit(fs_info, "unable to find logical %llu length %llu",
3006+
btrfs_crit(fs_info,
3007+
"unable to find chunk map for logical %llu length %llu",
30073008
logical, length);
30083009
return ERR_PTR(-EINVAL);
30093010
}
30103011

30113012
if (em->start > logical || em->start + em->len <= logical) {
30123013
btrfs_crit(fs_info,
3013-
"found a bad mapping, wanted %llu-%llu, found %llu-%llu",
3014-
logical, length, em->start, em->start + em->len);
3014+
"found a bad chunk map, wanted %llu-%llu, found %llu-%llu",
3015+
logical, logical + length, em->start, em->start + em->len);
30153016
free_extent_map(em);
30163017
return ERR_PTR(-EINVAL);
30173018
}

0 commit comments

Comments
 (0)