Commit d94f43b4 authored by Feifei Xu's avatar Feifei Xu Committed by David Sterba

Btrfs: self-tests: Support testing all possible sectorsizes and nodesizes

To test all possible sectorsizes, this commit adds a sectorsize
array. This commit executes the tests for all possible sectorsizes and
nodesizes.
Reviewed-by: default avatarJosef Bacik <jbacik@fb.com>
Signed-off-by: default avatarChandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: default avatarFeifei Xu <xufeifei@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ed9e4afd
...@@ -2318,32 +2318,42 @@ static void btrfs_print_mod_info(void) ...@@ -2318,32 +2318,42 @@ static void btrfs_print_mod_info(void)
static int btrfs_run_sanity_tests(void) static int btrfs_run_sanity_tests(void)
{ {
int ret; int ret, i;
u32 sectorsize, nodesize; u32 sectorsize, nodesize;
u32 test_sectorsize[] = {
sectorsize = PAGE_SIZE; PAGE_SIZE,
nodesize = PAGE_SIZE; };
ret = btrfs_init_test_fs(); ret = btrfs_init_test_fs();
if (ret) if (ret)
return ret; return ret;
for (i = 0; i < ARRAY_SIZE(test_sectorsize); i++) {
ret = btrfs_test_free_space_cache(sectorsize, nodesize); sectorsize = test_sectorsize[i];
if (ret) for (nodesize = sectorsize;
goto out; nodesize <= BTRFS_MAX_METADATA_BLOCKSIZE;
ret = btrfs_test_extent_buffer_operations(sectorsize, nodesize <<= 1) {
nodesize); pr_info("BTRFS: selftest: sectorsize: %u nodesize: %u\n",
if (ret) sectorsize, nodesize);
goto out; ret = btrfs_test_free_space_cache(sectorsize, nodesize);
ret = btrfs_test_extent_io(sectorsize, nodesize); if (ret)
if (ret) goto out;
goto out; ret = btrfs_test_extent_buffer_operations(sectorsize,
ret = btrfs_test_inodes(sectorsize, nodesize); nodesize);
if (ret) if (ret)
goto out; goto out;
ret = btrfs_test_qgroups(sectorsize, nodesize); ret = btrfs_test_extent_io(sectorsize, nodesize);
if (ret) if (ret)
goto out; goto out;
ret = btrfs_test_free_space_tree(sectorsize, nodesize); ret = btrfs_test_inodes(sectorsize, nodesize);
if (ret)
goto out;
ret = btrfs_test_qgroups(sectorsize, nodesize);
if (ret)
goto out;
ret = btrfs_test_free_space_tree(sectorsize, nodesize);
if (ret)
goto out;
}
}
out: out:
btrfs_destroy_test_fs(); btrfs_destroy_test_fs();
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment