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

btrfs: scrub, only lookup for csums if we are dealing with a data extent

When scrubbing a stripe, whenever we find an extent we lookup for its
checksums in the checksum tree. However we do it even for metadata extents
which don't have checksum items stored in the checksum tree, that is
only for data extents.

So make the lookup for checksums only if we are processing with a data
extent.
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 684b752b
...@@ -3343,13 +3343,14 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, ...@@ -3343,13 +3343,14 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
&extent_dev, &extent_dev,
&extent_mirror_num); &extent_mirror_num);
if (flags & BTRFS_EXTENT_FLAG_DATA) {
ret = btrfs_lookup_csums_range(csum_root, ret = btrfs_lookup_csums_range(csum_root,
extent_logical, extent_logical,
extent_logical + extent_logical + extent_len - 1,
extent_len - 1,
&sctx->csum_list, 1); &sctx->csum_list, 1);
if (ret) if (ret)
goto out; goto out;
}
ret = scrub_extent(sctx, map, extent_logical, extent_len, ret = scrub_extent(sctx, map, extent_logical, extent_len,
extent_physical, extent_dev, flags, extent_physical, extent_dev, flags,
......
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