Btrfs: self-tests: Support non-4k page size
self-tests code assumes 4k as the sectorsize and nodesize. This commit fix hardcoded 4K. Enables the self-tests code to be executed on non-4k page sized systems (e.g. ppc64). 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:
@@ -1147,7 +1147,8 @@ struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
|
||||
u64 bytenr)
|
||||
{
|
||||
if (btrfs_test_is_dummy_root(root))
|
||||
return alloc_test_extent_buffer(root->fs_info, bytenr);
|
||||
return alloc_test_extent_buffer(root->fs_info, bytenr,
|
||||
root->nodesize);
|
||||
return alloc_extent_buffer(root->fs_info, bytenr);
|
||||
}
|
||||
|
||||
@@ -1314,14 +1315,15 @@ static struct btrfs_root *btrfs_alloc_root(struct btrfs_fs_info *fs_info,
|
||||
|
||||
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
|
||||
/* Should only be used by the testing infrastructure */
|
||||
struct btrfs_root *btrfs_alloc_dummy_root(void)
|
||||
struct btrfs_root *btrfs_alloc_dummy_root(u32 sectorsize, u32 nodesize)
|
||||
{
|
||||
struct btrfs_root *root;
|
||||
|
||||
root = btrfs_alloc_root(NULL, GFP_KERNEL);
|
||||
if (!root)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
__setup_root(4096, 4096, 4096, root, NULL, 1);
|
||||
/* We don't use the stripesize in selftest, set it as sectorsize */
|
||||
__setup_root(nodesize, sectorsize, sectorsize, root, NULL, 1);
|
||||
set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state);
|
||||
root->alloc_bytenr = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user