]> git.hungrycats.org Git - bees/commitdiff
extent scan: don't put non-data block groups in the data extent map
authorZygo Blaxell <bees@furryterror.org>
Sat, 4 Jan 2025 00:55:44 +0000 (19:55 -0500)
committerZygo Blaxell <bees@furryterror.org>
Sat, 4 Jan 2025 04:32:48 +0000 (23:32 -0500)
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>
src/bees-roots.cc

index 02faa7febe242292758256ae231455c2bf79f02e..6294768f5a4a06d167b569ea51fa7ab08463b71a 100644 (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;
        }