Skip to content

Commit 875eeda

Browse files
fdmananagregkh
authored andcommitted
btrfs: make error messages more clear when getting a chunk map
commit 7d410d5 upstream. 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: stable@vger.kernel.org # 5.4+ Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4769383 commit 875eeda

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

fs/btrfs/volumes.c

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

30663066
if (!em) {
3067-
btrfs_crit(fs_info, "unable to find logical %llu length %llu",
3067+
btrfs_crit(fs_info,
3068+
"unable to find chunk map for logical %llu length %llu",
30683069
logical, length);
30693070
return ERR_PTR(-EINVAL);
30703071
}
30713072

30723073
if (em->start > logical || em->start + em->len <= logical) {
30733074
btrfs_crit(fs_info,
3074-
"found a bad mapping, wanted %llu-%llu, found %llu-%llu",
3075-
logical, length, em->start, em->start + em->len);
3075+
"found a bad chunk map, wanted %llu-%llu, found %llu-%llu",
3076+
logical, logical + length, em->start, em->start + em->len);
30763077
free_extent_map(em);
30773078
return ERR_PTR(-EINVAL);
30783079
}

0 commit comments

Comments
 (0)