diff mbox

[V2,5/8] Btrfs: self-tests: Support testing all possible sectorsizes and nodesizes

Message ID 201606011120.u51BJVGc003246@mx0a-001b2d01.pphosted.com (mailing list archive)
State Superseded
Headers show

Commit Message

Feifei Xu June 1, 2016, 11:18 a.m. UTC
To test all possible sectorsizes, this commit adds a sectorsize
array. This commit executes the tests for all possible sectorsizes and
nodesizes.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com>
---
 fs/btrfs/super.c | 54 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 22 deletions(-)

Comments

David Sterba June 1, 2016, 12:21 p.m. UTC | #1
On Wed, Jun 01, 2016 at 07:18:27PM +0800, Feifei Xu wrote:
> To test all possible sectorsizes, this commit adds a sectorsize
> array. This commit executes the tests for all possible sectorsizes and
> nodesizes.
> 
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
> Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com>
> ---
>  fs/btrfs/super.c | 54 ++++++++++++++++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 22 deletions(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 5b0b354..c49d7ae 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -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;

This does not seem to apply to any branch I'd expect to be relevant
(master, for-linus, chandan's main patchset), please clarify.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Sterba June 1, 2016, 12:33 p.m. UTC | #2
On Wed, Jun 01, 2016 at 02:21:18PM +0200, David Sterba wrote:
> >  static int btrfs_run_sanity_tests(void)
> >  {
> > -	int ret;
> > +	int ret, i;
> >  	u32 sectorsize, nodesize;
> > -
> > -	sectorsize = PAGE_SIZE;
> > -	nodesize = PAGE_SIZE;
> 
> This does not seem to apply to any branch I'd expect to be relevant
> (master, for-linus, chandan's main patchset), please clarify.

Aha, sorry, this was in patch 3. BTW, please fix the mail threading so
the patches are replies to the cover letter. I fixed that manually in
mutt but did not add all the patches that arrived later.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 5b0b354..c49d7ae 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -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;