Message ID | 20171221224256.18196-9-bo.li.liu@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 22.12.2017 00:42, Liu Bo wrote: > This is a subtle case, so in order to understand the problem, it'd be good to > know the content of existing and em when any error occurs. > > Signed-off-by: Liu Bo <bo.li.liu@oracle.com> > --- > fs/btrfs/extent_map.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c > index d386cfb..a8b7e24 100644 > --- a/fs/btrfs/extent_map.c > +++ b/fs/btrfs/extent_map.c > @@ -550,17 +550,23 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree, > *em_in = existing; > ret = 0; > } else { > + u64 orig_start = em->start; > + u64 orig_len = em->len; > + > /* > * The existing extent map is the one nearest to > * the [start, start + len) range which overlaps > */ > ret = merge_extent_mapping(em_tree, existing, > em, start, len); > - free_extent_map(existing); > if (ret) { > free_extent_map(em); > *em_in = NULL; > + WARN_ONCE(ret, KERN_INFO "Unexpected error %d: merge existing(start %llu len %llu) with em(start %llu len %llu)\n", I think this KERN_INFO is spurious and should be removed? > + ret, existing->start, existing->len, > + orig_start, orig_len); > } > + free_extent_map(existing); > } > } > > -- 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
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index d386cfb..a8b7e24 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -550,17 +550,23 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree, *em_in = existing; ret = 0; } else { + u64 orig_start = em->start; + u64 orig_len = em->len; + /* * The existing extent map is the one nearest to * the [start, start + len) range which overlaps */ ret = merge_extent_mapping(em_tree, existing, em, start, len); - free_extent_map(existing); if (ret) { free_extent_map(em); *em_in = NULL; + WARN_ONCE(ret, KERN_INFO "Unexpected error %d: merge existing(start %llu len %llu) with em(start %llu len %llu)\n", + ret, existing->start, existing->len, + orig_start, orig_len); } + free_extent_map(existing); } }
This is a subtle case, so in order to understand the problem, it'd be good to know the content of existing and em when any error occurs. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> --- fs/btrfs/extent_map.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)