]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Btrfs: self-tests: Support testing all possible sectorsizes and nodesizes
authorFeifei Xu <xufeifei@linux.vnet.ibm.com>
Wed, 1 Jun 2016 11:18:27 +0000 (19:18 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 6 Jun 2016 15:17:12 +0000 (17:17 +0200)
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>
fs/btrfs/super.c

index 5b0b354ca594fe8b16851f7c90b649d0cdab3b76..c49d7ae6961736f0da49e75ff5b46ec253d50b83 100644 (file)
@@ -2318,32 +2318,42 @@ 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;
-
-       ret = btrfs_test_free_space_cache(sectorsize, nodesize);
-       if (ret)
-               goto out;
-       ret = btrfs_test_extent_buffer_operations(sectorsize,
-               nodesize);
-       if (ret)
-               goto out;
-       ret = btrfs_test_extent_io(sectorsize, nodesize);
-       if (ret)
-               goto out;
-       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);
+       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;
+                       ret = btrfs_test_extent_buffer_operations(sectorsize,
+                               nodesize);
+                       if (ret)
+                               goto out;
+                       ret = btrfs_test_extent_io(sectorsize, nodesize);
+                       if (ret)
+                               goto out;
+                       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:
        btrfs_destroy_test_fs();
        return ret;