From 87472b608659138636edea66886a04b8b1580da5 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Fri, 3 Jan 2025 19:55:44 -0500 Subject: [PATCH] extent scan: don't put non-data block groups in the data extent map The total data size should not include metadata or system block groups, and already does not; however, we still have these block groups in the map for mapping the crawl pointer to a logical offset within the filesystem. Rearrange a few lines around the `if` statement so that the map doesn't contain anything it should not. Signed-off-by: Zygo Blaxell --- src/bees-roots.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bees-roots.cc b/src/bees-roots.cc index 02faa7f..6294768 100644 --- a/src/bees-roots.cc +++ b/src/bees-roots.cc @@ -966,15 +966,15 @@ BeesScanModeExtent::next_transid(const CrawlMap &crawl_map_unused) THROW_CHECK0(runtime_error, offset > 0); THROW_CHECK0(runtime_error, chunk_length > 0); last_bgaddr = offset + chunk_length; - bg_info_map[last_bgaddr] = (bg_info) { - .first_bytenr = offset, - .first_total = fs_size, - }; // Mixed-bg filesystems have block groups that are data _and_ metadata. // Block groups that are _only_ metadata should be filtered out. if (0 == (bti.chunk_type() & BTRFS_BLOCK_GROUP_DATA)) { continue; } + bg_info_map[last_bgaddr] = (bg_info) { + .first_bytenr = offset, + .first_total = fs_size, + }; fs_size += chunk_length; }