Skip to contentSkip to conversation

Btrfs: scrub, only lookup for ccums if we are dealing with a data extent

PATCH In review [email protected] 1 participant 1 message May 8, 2020 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Btrfs: scrub, only lookup for ccums if we are dealing with a data extent

From: Filipe Manana <[email protected]>

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.

---
 fs/btrfs/scrub.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
fs/btrfs/scrub.c +10 -7
index 2486f58d8205..c3b670858f8a 100644
@@ -3343,13 +3343,16 @@ 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,
Signature · 1 line
2.11.0