diff options
author | Jeff Mahoney <jeffm@suse.com> | 2016-06-20 20:14:09 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-07-26 13:53:18 +0200 |
commit | 7c0260ee098db7a05fd68812b2e21ce2e19dfcf0 (patch) | |
tree | 25e787514a685917ab6b11535275e831001d24f5 /fs/btrfs/tests/free-space-tests.c | |
parent | btrfs: tests, move initialization into tests/ (diff) | |
download | linux-7c0260ee098db7a05fd68812b2e21ce2e19dfcf0.tar.xz linux-7c0260ee098db7a05fd68812b2e21ce2e19dfcf0.zip |
btrfs: tests, require fs_info for root
This allows the upcoming patchset to push nodesize and sectorsize into
fs_info.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tests/free-space-tests.c')
-rw-r--r-- | fs/btrfs/tests/free-space-tests.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/btrfs/tests/free-space-tests.c b/fs/btrfs/tests/free-space-tests.c index 3956bb2ff84c..3221c8dee272 100644 --- a/fs/btrfs/tests/free-space-tests.c +++ b/fs/btrfs/tests/free-space-tests.c @@ -837,6 +837,7 @@ test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache, int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize) { + struct btrfs_fs_info *fs_info; struct btrfs_block_group_cache *cache; struct btrfs_root *root = NULL; int ret = -ENOMEM; @@ -855,15 +856,17 @@ int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize) return 0; } - root = btrfs_alloc_dummy_root(sectorsize, nodesize); - if (IS_ERR(root)) { - ret = PTR_ERR(root); + fs_info = btrfs_alloc_dummy_fs_info(); + if (!fs_info) { + ret = -ENOMEM; goto out; } - root->fs_info = btrfs_alloc_dummy_fs_info(); - if (!root->fs_info) + root = btrfs_alloc_dummy_root(fs_info, sectorsize, nodesize); + if (IS_ERR(root)) { + ret = PTR_ERR(root); goto out; + } root->fs_info->extent_root = root; cache->fs_info = root->fs_info; @@ -882,6 +885,7 @@ int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize) out: btrfs_free_dummy_block_group(cache); btrfs_free_dummy_root(root); + btrfs_free_dummy_fs_info(fs_info); test_msg("Free space cache tests finished\n"); return ret; } |