Commit 21334600 authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: use btrfs_warn() to log message at btrfs_add_extent_mapping()

At btrfs_add_extent_mapping(), if we failed to merge the extent map, which
is unexpected and theoretically should never happen, we use WARN_ONCE() to
log a message which is not great because we don't get information about
which filesystem it relates to in case we have multiple btrfs filesystems
mounted. So change this to use btrfs_warn() and surround the error check
with WARN_ON() so we always get a useful stack trace and the condition is
flagged as "unlikely" since it's not expected to ever happen.
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 379c8723
...@@ -629,13 +629,13 @@ int btrfs_add_extent_mapping(struct btrfs_fs_info *fs_info, ...@@ -629,13 +629,13 @@ int btrfs_add_extent_mapping(struct btrfs_fs_info *fs_info,
*/ */
ret = merge_extent_mapping(em_tree, existing, ret = merge_extent_mapping(em_tree, existing,
em, start); em, start);
if (ret) { if (WARN_ON(ret)) {
free_extent_map(em); free_extent_map(em);
*em_in = NULL; *em_in = NULL;
WARN_ONCE(ret, btrfs_warn(fs_info,
"extent map merge error existing [%llu, %llu) with em [%llu, %llu) start %llu\n", "extent map merge error existing [%llu, %llu) with em [%llu, %llu) start %llu",
existing->start, extent_map_end(existing), existing->start, extent_map_end(existing),
orig_start, orig_start + orig_len, start); orig_start, orig_start + orig_len, start);
} }
free_extent_map(existing); free_extent_map(existing);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment