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: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana 2020-05-08 11:02:07 +01:00 committed by David Sterba
parent 684b752b09
commit 89490303a4

View File

@ -3343,13 +3343,14 @@ again:
&extent_dev,
&extent_mirror_num);
ret = btrfs_lookup_csums_range(csum_root,
extent_logical,
extent_logical +
extent_len - 1,
&sctx->csum_list, 1);
if (ret)
goto out;
if (flags & BTRFS_EXTENT_FLAG_DATA) {
ret = btrfs_lookup_csums_range(csum_root,
extent_logical,
extent_logical + extent_len - 1,
&sctx->csum_list, 1);
if (ret)
goto out;
}
ret = scrub_extent(sctx, map, extent_logical, extent_len,
extent_physical, extent_dev, flags,