diff mbox series

[10/11] btrfs: don't do the global_id thing if we are a DUMMY_FS_INFO

Message ID 43b43374beb50ec94e26260ddcf06e303bc3cfa5.1646692474.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: add snapshot_id to btrfs_header and root_item | expand

Commit Message

Josef Bacik March 7, 2022, 10:37 p.m. UTC
I want to use extent tree v2 in our self tests to make sure the extent
buffer related tests all do the correct thing, which requires setting
BTRFS_FEATURE_INCOMPAT_EXTENT_TREE_V2 on the fs_info.  However we won't
be having per-block group global roots for the dummy fs_info, so add
another check to btrfs_global_root_id to bail if we have DUMMY set.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/disk-io.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c4e9d69ed672..00e97156101b 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1308,6 +1308,10 @@  static u64 btrfs_global_root_id(struct btrfs_fs_info *fs_info, u64 bytenr)
 	struct btrfs_block_group *block_group;
 	u64 ret;
 
+#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+	if (test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state))
+		return 0;
+#endif
 	if (!btrfs_fs_incompat(fs_info, EXTENT_TREE_V2))
 		return 0;