forked from luck/tmp_suning_uos_patched
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: Josef Bacik <jbacik@fb.com> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ed9e4afdb0
commit
d94f43b4c6
|
@ -2318,15 +2318,21 @@ static void btrfs_print_mod_info(void)
|
|||
|
||||
static int btrfs_run_sanity_tests(void)
|
||||
{
|
||||
int ret;
|
||||
int ret, i;
|
||||
u32 sectorsize, nodesize;
|
||||
|
||||
sectorsize = PAGE_SIZE;
|
||||
nodesize = PAGE_SIZE;
|
||||
u32 test_sectorsize[] = {
|
||||
PAGE_SIZE,
|
||||
};
|
||||
ret = btrfs_init_test_fs();
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(test_sectorsize); i++) {
|
||||
sectorsize = test_sectorsize[i];
|
||||
for (nodesize = sectorsize;
|
||||
nodesize <= BTRFS_MAX_METADATA_BLOCKSIZE;
|
||||
nodesize <<= 1) {
|
||||
pr_info("BTRFS: selftest: sectorsize: %u nodesize: %u\n",
|
||||
sectorsize, nodesize);
|
||||
ret = btrfs_test_free_space_cache(sectorsize, nodesize);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
@ -2344,6 +2350,10 @@ static int btrfs_run_sanity_tests(void)
|
|||
if (ret)
|
||||
goto out;
|
||||
ret = btrfs_test_free_space_tree(sectorsize, nodesize);
|
||||
if (ret)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
out:
|
||||
btrfs_destroy_test_fs();
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue
Block a user