btrfs: Load only necessary csums into list in scrub
authorZhao Lei <zhaolei@cn.fujitsu.com>
Wed, 22 Jul 2015 05:14:47 +0000 (13:14 +0800)
committerChris Mason <clm@fb.com>
Sun, 9 Aug 2015 14:07:11 +0000 (07:07 -0700)
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 <zhaolei@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/scrub.c

index 185595a..b03dd10 100644 (file)
@@ -3254,9 +3254,11 @@ again:
                                                   &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;