mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-16 19:34:03 +00:00
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: Josef Bacik <jbacik@fb.com> Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
b9ef22dedd
commit
ed9e4afdb0
1 changed files with 30 additions and 19 deletions
|
@ -21,6 +21,7 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
#include "btrfs-tests.h"
|
#include "btrfs-tests.h"
|
||||||
|
#include "../ctree.h"
|
||||||
#include "../extent_io.h"
|
#include "../extent_io.h"
|
||||||
|
|
||||||
#define PROCESS_UNLOCK (1 << 0)
|
#define PROCESS_UNLOCK (1 << 0)
|
||||||
|
@ -298,25 +299,29 @@ static int __test_eb_bitmaps(unsigned long *bitmap, struct extent_buffer *eb,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap_set(bitmap, (PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
|
/* Straddling pages test */
|
||||||
sizeof(long) * BITS_PER_BYTE);
|
if (len > PAGE_SIZE) {
|
||||||
extent_buffer_bitmap_set(eb, PAGE_SIZE - sizeof(long) / 2, 0,
|
bitmap_set(bitmap,
|
||||||
sizeof(long) * BITS_PER_BYTE);
|
(PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
|
||||||
if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
|
sizeof(long) * BITS_PER_BYTE);
|
||||||
test_msg("Setting straddling pages failed\n");
|
extent_buffer_bitmap_set(eb, PAGE_SIZE - sizeof(long) / 2, 0,
|
||||||
return -EINVAL;
|
sizeof(long) * BITS_PER_BYTE);
|
||||||
}
|
if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
|
||||||
|
test_msg("Setting straddling pages failed\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
bitmap_set(bitmap, 0, len * BITS_PER_BYTE);
|
bitmap_set(bitmap, 0, len * BITS_PER_BYTE);
|
||||||
bitmap_clear(bitmap,
|
bitmap_clear(bitmap,
|
||||||
(PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
|
(PAGE_SIZE - sizeof(long) / 2) * BITS_PER_BYTE,
|
||||||
sizeof(long) * BITS_PER_BYTE);
|
sizeof(long) * BITS_PER_BYTE);
|
||||||
extent_buffer_bitmap_set(eb, 0, 0, len * BITS_PER_BYTE);
|
extent_buffer_bitmap_set(eb, 0, 0, len * BITS_PER_BYTE);
|
||||||
extent_buffer_bitmap_clear(eb, PAGE_SIZE - sizeof(long) / 2, 0,
|
extent_buffer_bitmap_clear(eb, PAGE_SIZE - sizeof(long) / 2, 0,
|
||||||
sizeof(long) * BITS_PER_BYTE);
|
sizeof(long) * BITS_PER_BYTE);
|
||||||
if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
|
if (memcmp_extent_buffer(eb, bitmap, 0, len) != 0) {
|
||||||
test_msg("Clearing straddling pages failed\n");
|
test_msg("Clearing straddling pages failed\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -359,7 +364,13 @@ static int test_eb_bitmaps(u32 sectorsize, u32 nodesize)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
test_msg("Running extent buffer bitmap tests\n");
|
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);
|
bitmap = kmalloc(len, GFP_KERNEL);
|
||||||
if (!bitmap) {
|
if (!bitmap) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue