diff options
Diffstat (limited to 'fs/btrfs/tests/extent-buffer-tests.c')
-rw-r--r-- | fs/btrfs/tests/extent-buffer-tests.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/btrfs/tests/extent-buffer-tests.c b/fs/btrfs/tests/extent-buffer-tests.c index 4f8cbd1ec5ee..199569174637 100644 --- a/fs/btrfs/tests/extent-buffer-tests.c +++ b/fs/btrfs/tests/extent-buffer-tests.c | |||
@@ -24,8 +24,9 @@ | |||
24 | 24 | ||
25 | static int test_btrfs_split_item(u32 sectorsize, u32 nodesize) | 25 | static int test_btrfs_split_item(u32 sectorsize, u32 nodesize) |
26 | { | 26 | { |
27 | struct btrfs_path *path; | 27 | struct btrfs_fs_info *fs_info; |
28 | struct btrfs_root *root; | 28 | struct btrfs_path *path = NULL; |
29 | struct btrfs_root *root = NULL; | ||
29 | struct extent_buffer *eb; | 30 | struct extent_buffer *eb; |
30 | struct btrfs_item *item; | 31 | struct btrfs_item *item; |
31 | char *value = "mary had a little lamb"; | 32 | char *value = "mary had a little lamb"; |
@@ -40,17 +41,24 @@ static int test_btrfs_split_item(u32 sectorsize, u32 nodesize) | |||
40 | 41 | ||
41 | test_msg("Running btrfs_split_item tests\n"); | 42 | test_msg("Running btrfs_split_item tests\n"); |
42 | 43 | ||
43 | root = btrfs_alloc_dummy_root(sectorsize, nodesize); | 44 | fs_info = btrfs_alloc_dummy_fs_info(); |
45 | if (!fs_info) { | ||
46 | test_msg("Could not allocate fs_info\n"); | ||
47 | return -ENOMEM; | ||
48 | } | ||
49 | |||
50 | root = btrfs_alloc_dummy_root(fs_info, sectorsize, nodesize); | ||
44 | if (IS_ERR(root)) { | 51 | if (IS_ERR(root)) { |
45 | test_msg("Could not allocate root\n"); | 52 | test_msg("Could not allocate root\n"); |
46 | return PTR_ERR(root); | 53 | ret = PTR_ERR(root); |
54 | goto out; | ||
47 | } | 55 | } |
48 | 56 | ||
49 | path = btrfs_alloc_path(); | 57 | path = btrfs_alloc_path(); |
50 | if (!path) { | 58 | if (!path) { |
51 | test_msg("Could not allocate path\n"); | 59 | test_msg("Could not allocate path\n"); |
52 | kfree(root); | 60 | ret = -ENOMEM; |
53 | return -ENOMEM; | 61 | goto out; |
54 | } | 62 | } |
55 | 63 | ||
56 | path->nodes[0] = eb = alloc_dummy_extent_buffer(NULL, nodesize, | 64 | path->nodes[0] = eb = alloc_dummy_extent_buffer(NULL, nodesize, |
@@ -219,7 +227,8 @@ static int test_btrfs_split_item(u32 sectorsize, u32 nodesize) | |||
219 | } | 227 | } |
220 | out: | 228 | out: |
221 | btrfs_free_path(path); | 229 | btrfs_free_path(path); |
222 | kfree(root); | 230 | btrfs_free_dummy_root(root); |
231 | btrfs_free_dummy_fs_info(fs_info); | ||
223 | return ret; | 232 | return ret; |
224 | } | 233 | } |
225 | 234 | ||