Skip to content

Commit 1ba19a6

Browse files
naotakdave
authored andcommitted
btrfs: tests: zoned: add tests cases for zoned code
Add a test function for the zoned code, for now it tests btrfs_load_block_group_by_raid_type() with various test cases. The load_zone_info_tests[] array defines the test cases. Signed-off-by: Naohiro Aota <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 591cd65 commit 1ba19a6

5 files changed

Lines changed: 695 additions & 0 deletions

File tree

fs/btrfs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/free-space-tests.o \
4545
tests/free-space-tree-tests.o tests/extent-map-tests.o \
4646
tests/raid-stripe-tree-tests.o tests/delayed-refs-tests.o \
4747
tests/chunk-allocation-tests.o
48+
49+
ifeq ($(CONFIG_BLK_DEV_ZONED),y)
50+
btrfs-$(CONFIG_BTRFS_FS_RUN_SANITY_TESTS) += tests/zoned-tests.o
51+
endif

fs/btrfs/tests/btrfs-tests.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ int btrfs_run_sanity_tests(void)
303303
}
304304
}
305305
ret = btrfs_test_extent_map();
306+
if (ret)
307+
goto out;
308+
ret = btrfs_test_zoned();
306309

307310
out:
308311
btrfs_destroy_test_fs();

fs/btrfs/tests/btrfs-tests.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ void btrfs_init_dummy_trans(struct btrfs_trans_handle *trans,
6363
struct btrfs_fs_info *fs_info);
6464
void btrfs_init_dummy_transaction(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info);
6565
struct btrfs_device *btrfs_alloc_dummy_device(struct btrfs_fs_info *fs_info);
66+
67+
#ifdef CONFIG_BLK_DEV_ZONED
68+
int btrfs_test_zoned(void);
69+
#else
70+
static inline int btrfs_test_zoned(void)
71+
{
72+
return 0;
73+
}
74+
#endif
75+
6676
#else
6777
static inline int btrfs_run_sanity_tests(void)
6878
{

0 commit comments

Comments
 (0)