1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 13:25:45 +02:00

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 <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2025-01-03 19:55:44 -05:00
parent ca351d389f
commit 87472b6086

View File

@ -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;
}