Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed9e4afd authored by Feifei Xu's avatar Feifei Xu Committed by David Sterba
Browse files

Btrfs: self-tests: Execute page straddling test only when nodesize < PAGE_SIZE



On ppc64, PAGE_SIZE is 64k which is same as BTRFS_MAX_METADATA_BLOCKSIZE.
In such a scenario, we will never be able to have an extent buffer
containing more than one page. Hence in such cases this commit does not
execute the page straddling tests.

Reviewed-by: default avatarJosef Bacik <jbacik@fb.com>
Signed-off-by: default avatarFeifei Xu <xufeifei@linux.vnet.ibm.com>
Signed-off-by: default avatarChandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent b9ef22de
Loading
Loading
Loading
Loading
+30 −19
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/slab.h>
#include <linux/sizes.h>
#include "btrfs-tests.h"
#include "../ctree.h"
#include "../extent_io.h"

#define PROCESS_UNLOCK		(1 << 0)
@@ -298,7 +299,10 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb,
		return -EINVAL;
	}

	bitmap_set(bitmap, (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
	/* Straddling pages test */
	if (len > PAGE_SIZE) {
		bitmap_set(bitmap,
			(PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
			sizeof(long) * BITS_PER_BYTE);
		extent_buffer_bitmap_set(eb, PAGE_SIZE - sizeof(long) / 2, 0,
					sizeof(long) * BITS_PER_BYTE);
@@ -318,6 +322,7 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb,
			test_msg("Clearing straddling pages failed\n");
			return -EINVAL;
		}
	}

	/*
	 * Generate a wonky pseudo-random bit pattern for the sake of not using
@@ -359,7 +364,13 @@ static int test_eb_bitmaps(u32 sectorsize, u32 nodesize)
	int ret;

	test_msg("Running extent buffer bitmap tests\n");
	len = sectorsize * 4;

	/*
	 * In ppc64, sectorsize can be 64K, thus 4 * 64K will be larger than
	 * BTRFS_MAX_METADATA_BLOCKSIZE.
	 */
	len = (sectorsize < BTRFS_MAX_METADATA_BLOCKSIZE)
		? sectorsize * 4 : sectorsize;

	bitmap = kmalloc(len, GFP_KERNEL);
	if (!bitmap) {