Skip to content

Commit

Permalink
btrfs: scrub, only lookup for csums if we are dealing with a data extent
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Filipe Manana authored and David Sterba committed May 25, 2020
1 parent 684b752 commit 8949030
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3343,13 +3343,14 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
&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,
Expand Down

0 comments on commit 8949030

Please sign in to comment.