aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/backref.c2
-rw-r--r--fs/btrfs/ctree.c2
-rw-r--r--fs/btrfs/ctree.h17
-rw-r--r--fs/btrfs/disk-io.c3
-rw-r--r--fs/btrfs/extent-tree.c8
-rw-r--r--fs/btrfs/inode.c4
-rw-r--r--fs/btrfs/qgroup.c4
7 files changed, 19 insertions, 21 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 1ac8a3c7f68e..2b88439c2ee8 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -361,7 +361,7 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info,
361 goto out; 361 goto out;
362 } 362 }
363 363
364 if (btrfs_test_is_dummy_root(root)) { 364 if (btrfs_is_testing(fs_info)) {
365 srcu_read_unlock(&fs_info->subvol_srcu, index); 365 srcu_read_unlock(&fs_info->subvol_srcu, index);
366 ret = -ENOENT; 366 ret = -ENOENT;
367 goto out; 367 goto out;
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 0abed1a0caa7..e926b9fdb64a 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1505,7 +1505,7 @@ static inline int should_cow_block(struct btrfs_trans_handle *trans,
1505 struct btrfs_root *root, 1505 struct btrfs_root *root,
1506 struct extent_buffer *buf) 1506 struct extent_buffer *buf)
1507{ 1507{
1508 if (btrfs_test_is_dummy_root(root)) 1508 if (btrfs_is_testing(root->fs_info))
1509 return 0; 1509 return 0;
1510 1510
1511 /* ensure we can see the force_cow */ 1511 /* ensure we can see the force_cow */
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 1cb84e01f2fd..41d5ca986c0c 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1115,12 +1115,11 @@ struct btrfs_subvolume_writers {
1115#define BTRFS_ROOT_REF_COWS 1 1115#define BTRFS_ROOT_REF_COWS 1
1116#define BTRFS_ROOT_TRACK_DIRTY 2 1116#define BTRFS_ROOT_TRACK_DIRTY 2
1117#define BTRFS_ROOT_IN_RADIX 3 1117#define BTRFS_ROOT_IN_RADIX 3
1118#define BTRFS_ROOT_DUMMY_ROOT 4 1118#define BTRFS_ROOT_ORPHAN_ITEM_INSERTED 4
1119#define BTRFS_ROOT_ORPHAN_ITEM_INSERTED 5 1119#define BTRFS_ROOT_DEFRAG_RUNNING 5
1120#define BTRFS_ROOT_DEFRAG_RUNNING 6 1120#define BTRFS_ROOT_FORCE_COW 6
1121#define BTRFS_ROOT_FORCE_COW 7 1121#define BTRFS_ROOT_MULTI_LOG_TASKS 7
1122#define BTRFS_ROOT_MULTI_LOG_TASKS 8 1122#define BTRFS_ROOT_DIRTY 8
1123#define BTRFS_ROOT_DIRTY 9
1124 1123
1125/* 1124/*
1126 * in ram representation of the tree. extent_root is used for all allocations 1125 * in ram representation of the tree. extent_root is used for all allocations
@@ -3613,13 +3612,13 @@ static inline int btrfs_defrag_cancelled(struct btrfs_fs_info *fs_info)
3613void btrfs_test_destroy_inode(struct inode *inode); 3612void btrfs_test_destroy_inode(struct inode *inode);
3614#endif 3613#endif
3615 3614
3616static inline int btrfs_test_is_dummy_root(struct btrfs_root *root) 3615static inline int btrfs_is_testing(struct btrfs_fs_info *fs_info)
3617{ 3616{
3618#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS 3617#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
3619 if (unlikely(test_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state))) 3618 if (unlikely(test_bit(BTRFS_FS_STATE_DUMMY_FS_INFO,
3619 &fs_info->fs_state)))
3620 return 1; 3620 return 1;
3621#endif 3621#endif
3622 return 0; 3622 return 0;
3623} 3623}
3624
3625#endif 3624#endif
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 8e838b1cc806..ff2362dca91a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1146,7 +1146,7 @@ struct extent_buffer *btrfs_find_tree_block(struct btrfs_fs_info *fs_info,
1146struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, 1146struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
1147 u64 bytenr) 1147 u64 bytenr)
1148{ 1148{
1149 if (btrfs_test_is_dummy_root(root)) 1149 if (btrfs_is_testing(root->fs_info))
1150 return alloc_test_extent_buffer(root->fs_info, bytenr, 1150 return alloc_test_extent_buffer(root->fs_info, bytenr,
1151 root->nodesize); 1151 root->nodesize);
1152 return alloc_extent_buffer(root->fs_info, bytenr); 1152 return alloc_extent_buffer(root->fs_info, bytenr);
@@ -1330,7 +1330,6 @@ struct btrfs_root *btrfs_alloc_dummy_root(struct btrfs_fs_info *fs_info,
1330 /* We don't use the stripesize in selftest, set it as sectorsize */ 1330 /* We don't use the stripesize in selftest, set it as sectorsize */
1331 __setup_root(nodesize, sectorsize, sectorsize, root, fs_info, 1331 __setup_root(nodesize, sectorsize, sectorsize, root, fs_info,
1332 BTRFS_ROOT_TREE_OBJECTID); 1332 BTRFS_ROOT_TREE_OBJECTID);
1333 set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state);
1334 root->alloc_bytenr = 0; 1333 root->alloc_bytenr = 0;
1335 1334
1336 return root; 1335 return root;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 44b529f183e3..c4487e177234 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3235,7 +3235,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans,
3235 u64, u64, u64, u64, u64, u64); 3235 u64, u64, u64, u64, u64, u64);
3236 3236
3237 3237
3238 if (btrfs_test_is_dummy_root(root)) 3238 if (btrfs_is_testing(root->fs_info))
3239 return 0; 3239 return 0;
3240 3240
3241 ref_root = btrfs_header_owner(buf); 3241 ref_root = btrfs_header_owner(buf);
@@ -6101,7 +6101,7 @@ void btrfs_delalloc_release_metadata(struct inode *inode, u64 num_bytes)
6101 if (dropped > 0) 6101 if (dropped > 0)
6102 to_free += btrfs_calc_trans_metadata_size(root, dropped); 6102 to_free += btrfs_calc_trans_metadata_size(root, dropped);
6103 6103
6104 if (btrfs_test_is_dummy_root(root)) 6104 if (btrfs_is_testing(root->fs_info))
6105 return; 6105 return;
6106 6106
6107 trace_btrfs_space_reservation(root->fs_info, "delalloc", 6107 trace_btrfs_space_reservation(root->fs_info, "delalloc",
@@ -7217,7 +7217,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root *root,
7217 int ret; 7217 int ret;
7218 struct btrfs_fs_info *fs_info = root->fs_info; 7218 struct btrfs_fs_info *fs_info = root->fs_info;
7219 7219
7220 if (btrfs_test_is_dummy_root(root)) 7220 if (btrfs_is_testing(fs_info))
7221 return 0; 7221 return 0;
7222 7222
7223 add_pinned_bytes(root->fs_info, num_bytes, owner, root_objectid); 7223 add_pinned_bytes(root->fs_info, num_bytes, owner, root_objectid);
@@ -8356,7 +8356,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,
8356 SKINNY_METADATA); 8356 SKINNY_METADATA);
8357 8357
8358#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS 8358#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
8359 if (btrfs_test_is_dummy_root(root)) { 8359 if (btrfs_is_testing(root->fs_info)) {
8360 buf = btrfs_init_new_buffer(trans, root, root->alloc_bytenr, 8360 buf = btrfs_init_new_buffer(trans, root, root->alloc_bytenr,
8361 level); 8361 level);
8362 if (!IS_ERR(buf)) 8362 if (!IS_ERR(buf))
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b166ee0763b6..3f0311bb4d34 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1744,7 +1744,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
1744 } 1744 }
1745 1745
1746 /* For sanity tests */ 1746 /* For sanity tests */
1747 if (btrfs_test_is_dummy_root(root)) 1747 if (btrfs_is_testing(root->fs_info))
1748 return; 1748 return;
1749 1749
1750 __percpu_counter_add(&root->fs_info->delalloc_bytes, len, 1750 __percpu_counter_add(&root->fs_info->delalloc_bytes, len,
@@ -1803,7 +1803,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
1803 btrfs_delalloc_release_metadata(inode, len); 1803 btrfs_delalloc_release_metadata(inode, len);
1804 1804
1805 /* For sanity tests. */ 1805 /* For sanity tests. */
1806 if (btrfs_test_is_dummy_root(root)) 1806 if (btrfs_is_testing(root->fs_info))
1807 return; 1807 return;
1808 1808
1809 if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID 1809 if (root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 13e28d8a7d42..3a83631c1176 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -571,7 +571,7 @@ static int add_qgroup_item(struct btrfs_trans_handle *trans,
571 struct extent_buffer *leaf; 571 struct extent_buffer *leaf;
572 struct btrfs_key key; 572 struct btrfs_key key;
573 573
574 if (btrfs_test_is_dummy_root(quota_root)) 574 if (btrfs_is_testing(quota_root->fs_info))
575 return 0; 575 return 0;
576 576
577 path = btrfs_alloc_path(); 577 path = btrfs_alloc_path();
@@ -728,7 +728,7 @@ static int update_qgroup_info_item(struct btrfs_trans_handle *trans,
728 int ret; 728 int ret;
729 int slot; 729 int slot;
730 730
731 if (btrfs_test_is_dummy_root(root)) 731 if (btrfs_is_testing(root->fs_info))
732 return 0; 732 return 0;
733 733
734 key.objectid = 0; 734 key.objectid = 0;