Skip to content

Commit

Permalink
btrfs: Load only necessary csums into list in scrub
Browse files Browse the repository at this point in the history
We need not load csum of whole strip in scrub because strip is trimed
before use, it is to say, what we really need to calculate csum is
data between [extent_logical, extent_len).

This patch changed to use above segment for btrfs_lookup_csums_range()
in scrub_stripe()

Signed-off-by: Zhao Lei <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
zhaoleidd authored and masoncl committed Aug 9, 2015
1 parent a0dd59d commit fe8cf65
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -3254,9 +3254,11 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
&extent_dev,
&extent_mirror_num);

ret = btrfs_lookup_csums_range(csum_root, logical,
logical + map->stripe_len - 1,
&sctx->csum_list, 1);
ret = btrfs_lookup_csums_range(csum_root,
extent_logical,
extent_logical +
extent_len - 1,
&sctx->csum_list, 1);
if (ret)
goto out;

Expand Down

0 comments on commit fe8cf65

Please sign in to comment.