hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/fs/btrfs/tests/free-space-tests.c
....@@ -8,6 +8,7 @@
88 #include "../ctree.h"
99 #include "../disk-io.h"
1010 #include "../free-space-cache.h"
11
+#include "../block-group.h"
1112
1213 #define BITS_PER_BITMAP (PAGE_SIZE * 8UL)
1314
....@@ -16,7 +17,7 @@
1617 * entry and remove space from either end and the middle, and make sure we can
1718 * remove space that covers adjacent extent entries.
1819 */
19
-static int test_extents(struct btrfs_block_group_cache *cache)
20
+static int test_extents(struct btrfs_block_group *cache)
2021 {
2122 int ret = 0;
2223
....@@ -86,8 +87,7 @@
8687 return 0;
8788 }
8889
89
-static int test_bitmaps(struct btrfs_block_group_cache *cache,
90
- u32 sectorsize)
90
+static int test_bitmaps(struct btrfs_block_group *cache, u32 sectorsize)
9191 {
9292 u64 next_bitmap_offset;
9393 int ret;
....@@ -155,7 +155,7 @@
155155 }
156156
157157 /* This is the high grade jackassery */
158
-static int test_bitmaps_and_extents(struct btrfs_block_group_cache *cache,
158
+static int test_bitmaps_and_extents(struct btrfs_block_group *cache,
159159 u32 sectorsize)
160160 {
161161 u64 bitmap_offset = (u64)(BITS_PER_BITMAP * sectorsize);
....@@ -330,7 +330,7 @@
330330
331331 /* Used by test_steal_space_from_bitmap_to_extent(). */
332332 static int
333
-check_num_extents_and_bitmaps(const struct btrfs_block_group_cache *cache,
333
+check_num_extents_and_bitmaps(const struct btrfs_block_group *cache,
334334 const int num_extents,
335335 const int num_bitmaps)
336336 {
....@@ -350,7 +350,7 @@
350350 }
351351
352352 /* Used by test_steal_space_from_bitmap_to_extent(). */
353
-static int check_cache_empty(struct btrfs_block_group_cache *cache)
353
+static int check_cache_empty(struct btrfs_block_group *cache)
354354 {
355355 u64 offset;
356356 u64 max_extent_size;
....@@ -392,7 +392,7 @@
392392 * requests.
393393 */
394394 static int
395
-test_steal_space_from_bitmap_to_extent(struct btrfs_block_group_cache *cache,
395
+test_steal_space_from_bitmap_to_extent(struct btrfs_block_group *cache,
396396 u32 sectorsize)
397397 {
398398 int ret;
....@@ -404,7 +404,7 @@
404404 };
405405 const struct btrfs_free_space_op *orig_free_space_ops;
406406
407
- test_msg("running space stealing from bitmap to extent");
407
+ test_msg("running space stealing from bitmap to extent tests");
408408
409409 /*
410410 * For this test, we want to ensure we end up with an extent entry
....@@ -828,15 +828,16 @@
828828 int btrfs_test_free_space_cache(u32 sectorsize, u32 nodesize)
829829 {
830830 struct btrfs_fs_info *fs_info;
831
- struct btrfs_block_group_cache *cache;
831
+ struct btrfs_block_group *cache;
832832 struct btrfs_root *root = NULL;
833833 int ret = -ENOMEM;
834834
835835 test_msg("running btrfs free space cache tests");
836836 fs_info = btrfs_alloc_dummy_fs_info(nodesize, sectorsize);
837
- if (!fs_info)
837
+ if (!fs_info) {
838
+ test_std_err(TEST_ALLOC_FS_INFO);
838839 return -ENOMEM;
839
-
840
+ }
840841
841842 /*
842843 * For ppc64 (with 64k page size), bytes per bitmap might be
....@@ -846,13 +847,14 @@
846847 cache = btrfs_alloc_dummy_block_group(fs_info,
847848 BITS_PER_BITMAP * sectorsize + PAGE_SIZE);
848849 if (!cache) {
849
- test_err("couldn't run the tests");
850
+ test_std_err(TEST_ALLOC_BLOCK_GROUP);
850851 btrfs_free_dummy_fs_info(fs_info);
851852 return 0;
852853 }
853854
854855 root = btrfs_alloc_dummy_root(fs_info);
855856 if (IS_ERR(root)) {
857
+ test_std_err(TEST_ALLOC_ROOT);
856858 ret = PTR_ERR(root);
857859 goto out;
858860 }
....@@ -874,6 +876,5 @@
874876 btrfs_free_dummy_block_group(cache);
875877 btrfs_free_dummy_root(root);
876878 btrfs_free_dummy_fs_info(fs_info);
877
- test_msg("free space cache tests finished");
878879 return ret;
879880 }