diff options
Diffstat (limited to 'fs/btrfs/tests/inode-tests.c')
-rw-r--r-- | fs/btrfs/tests/inode-tests.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c index 397d1f99a8eb..3ae0f5b8bb80 100644 --- a/fs/btrfs/tests/inode-tests.c +++ b/fs/btrfs/tests/inode-tests.c | |||
@@ -23,33 +23,6 @@ | |||
23 | #include "../extent_io.h" | 23 | #include "../extent_io.h" |
24 | #include "../volumes.h" | 24 | #include "../volumes.h" |
25 | 25 | ||
26 | static struct btrfs_fs_info *alloc_dummy_fs_info(void) | ||
27 | { | ||
28 | struct btrfs_fs_info *fs_info = kzalloc(sizeof(struct btrfs_fs_info), | ||
29 | GFP_NOFS); | ||
30 | if (!fs_info) | ||
31 | return fs_info; | ||
32 | fs_info->fs_devices = kzalloc(sizeof(struct btrfs_fs_devices), | ||
33 | GFP_NOFS); | ||
34 | if (!fs_info->fs_devices) { | ||
35 | kfree(fs_info); | ||
36 | return NULL; | ||
37 | } | ||
38 | return fs_info; | ||
39 | } | ||
40 | static void free_dummy_root(struct btrfs_root *root) | ||
41 | { | ||
42 | if (!root) | ||
43 | return; | ||
44 | if (root->fs_info) { | ||
45 | kfree(root->fs_info->fs_devices); | ||
46 | kfree(root->fs_info); | ||
47 | } | ||
48 | if (root->node) | ||
49 | free_extent_buffer(root->node); | ||
50 | kfree(root); | ||
51 | } | ||
52 | |||
53 | static void insert_extent(struct btrfs_root *root, u64 start, u64 len, | 26 | static void insert_extent(struct btrfs_root *root, u64 start, u64 len, |
54 | u64 ram_bytes, u64 offset, u64 disk_bytenr, | 27 | u64 ram_bytes, u64 offset, u64 disk_bytenr, |
55 | u64 disk_len, u32 type, u8 compression, int slot) | 28 | u64 disk_len, u32 type, u8 compression, int slot) |
@@ -276,7 +249,7 @@ static noinline int test_btrfs_get_extent(void) | |||
276 | * We do this since btrfs_get_extent wants to assign em->bdev to | 249 | * We do this since btrfs_get_extent wants to assign em->bdev to |
277 | * root->fs_info->fs_devices->latest_bdev. | 250 | * root->fs_info->fs_devices->latest_bdev. |
278 | */ | 251 | */ |
279 | root->fs_info = alloc_dummy_fs_info(); | 252 | root->fs_info = btrfs_alloc_dummy_fs_info(); |
280 | if (!root->fs_info) { | 253 | if (!root->fs_info) { |
281 | test_msg("Couldn't allocate dummy fs info\n"); | 254 | test_msg("Couldn't allocate dummy fs info\n"); |
282 | goto out; | 255 | goto out; |
@@ -837,7 +810,7 @@ out: | |||
837 | if (!IS_ERR(em)) | 810 | if (!IS_ERR(em)) |
838 | free_extent_map(em); | 811 | free_extent_map(em); |
839 | iput(inode); | 812 | iput(inode); |
840 | free_dummy_root(root); | 813 | btrfs_free_dummy_root(root); |
841 | return ret; | 814 | return ret; |
842 | } | 815 | } |
843 | 816 | ||
@@ -864,7 +837,7 @@ static int test_hole_first(void) | |||
864 | goto out; | 837 | goto out; |
865 | } | 838 | } |
866 | 839 | ||
867 | root->fs_info = alloc_dummy_fs_info(); | 840 | root->fs_info = btrfs_alloc_dummy_fs_info(); |
868 | if (!root->fs_info) { | 841 | if (!root->fs_info) { |
869 | test_msg("Couldn't allocate dummy fs info\n"); | 842 | test_msg("Couldn't allocate dummy fs info\n"); |
870 | goto out; | 843 | goto out; |
@@ -934,7 +907,7 @@ out: | |||
934 | if (!IS_ERR(em)) | 907 | if (!IS_ERR(em)) |
935 | free_extent_map(em); | 908 | free_extent_map(em); |
936 | iput(inode); | 909 | iput(inode); |
937 | free_dummy_root(root); | 910 | btrfs_free_dummy_root(root); |
938 | return ret; | 911 | return ret; |
939 | } | 912 | } |
940 | 913 | ||