aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tests
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2014-06-14 21:20:26 -0400
committerDavid Sterba <dsterba@suse.cz>2014-12-12 12:26:55 -0500
commit3f556f7853ec4845a7c219d026cbcdf4cfa8cea7 (patch)
treecf3552bb4ed22bc7c46403549ca13043c40fe460 /fs/btrfs/tests
parent23d79d81b13431756fee428acde49c9b770da132 (diff)
btrfs: unify extent buffer allocation api
Make the extent buffer allocation interface consistent. Cloned eb will set a valid fs_info. For dummy eb, we can drop the length parameter and set it from fs_info. The built-in sanity checks may pass a NULL fs_info that's queried for nodesize, but we know it's 4096. Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'fs/btrfs/tests')
-rw-r--r--fs/btrfs/tests/extent-buffer-tests.c2
-rw-r--r--fs/btrfs/tests/inode-tests.c4
-rw-r--r--fs/btrfs/tests/qgroup-tests.c21
3 files changed, 13 insertions, 14 deletions
diff --git a/fs/btrfs/tests/extent-buffer-tests.c b/fs/btrfs/tests/extent-buffer-tests.c
index cc286ce97d1e..f51963a8f929 100644
--- a/fs/btrfs/tests/extent-buffer-tests.c
+++ b/fs/btrfs/tests/extent-buffer-tests.c
@@ -53,7 +53,7 @@ static int test_btrfs_split_item(void)
53 return -ENOMEM; 53 return -ENOMEM;
54 } 54 }
55 55
56 path->nodes[0] = eb = alloc_dummy_extent_buffer(0, 4096); 56 path->nodes[0] = eb = alloc_dummy_extent_buffer(NULL, 4096);
57 if (!eb) { 57 if (!eb) {
58 test_msg("Could not allocate dummy buffer\n"); 58 test_msg("Could not allocate dummy buffer\n");
59 ret = -ENOMEM; 59 ret = -ENOMEM;
diff --git a/fs/btrfs/tests/inode-tests.c b/fs/btrfs/tests/inode-tests.c
index 3ae0f5b8bb80..a116b55ce788 100644
--- a/fs/btrfs/tests/inode-tests.c
+++ b/fs/btrfs/tests/inode-tests.c
@@ -255,7 +255,7 @@ static noinline int test_btrfs_get_extent(void)
255 goto out; 255 goto out;
256 } 256 }
257 257
258 root->node = alloc_dummy_extent_buffer(0, 4096); 258 root->node = alloc_dummy_extent_buffer(NULL, 4096);
259 if (!root->node) { 259 if (!root->node) {
260 test_msg("Couldn't allocate dummy buffer\n"); 260 test_msg("Couldn't allocate dummy buffer\n");
261 goto out; 261 goto out;
@@ -843,7 +843,7 @@ static int test_hole_first(void)
843 goto out; 843 goto out;
844 } 844 }
845 845
846 root->node = alloc_dummy_extent_buffer(0, 4096); 846 root->node = alloc_dummy_extent_buffer(NULL, 4096);
847 if (!root->node) { 847 if (!root->node) {
848 test_msg("Couldn't allocate dummy buffer\n"); 848 test_msg("Couldn't allocate dummy buffer\n");
849 goto out; 849 goto out;
diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c
index ec3dcb202357..7336b1c09cd8 100644
--- a/fs/btrfs/tests/qgroup-tests.c
+++ b/fs/btrfs/tests/qgroup-tests.c
@@ -404,6 +404,16 @@ int btrfs_test_qgroups(void)
404 ret = -ENOMEM; 404 ret = -ENOMEM;
405 goto out; 405 goto out;
406 } 406 }
407 /* We are using this root as our extent root */
408 root->fs_info->extent_root = root;
409
410 /*
411 * Some of the paths we test assume we have a filled out fs_info, so we
412 * just need to add the root in there so we don't panic.
413 */
414 root->fs_info->tree_root = root;
415 root->fs_info->quota_root = root;
416 root->fs_info->quota_enabled = 1;
407 417
408 /* 418 /*
409 * Can't use bytenr 0, some things freak out 419 * Can't use bytenr 0, some things freak out
@@ -448,17 +458,6 @@ int btrfs_test_qgroups(void)
448 goto out; 458 goto out;
449 } 459 }
450 460
451 /* We are using this root as our extent root */
452 root->fs_info->extent_root = root;
453
454 /*
455 * Some of the paths we test assume we have a filled out fs_info, so we
456 * just need to addt he root in there so we don't panic.
457 */
458 root->fs_info->tree_root = root;
459 root->fs_info->quota_root = root;
460 root->fs_info->quota_enabled = 1;
461
462 test_msg("Running qgroup tests\n"); 461 test_msg("Running qgroup tests\n");
463 ret = test_no_shared_qgroup(root); 462 ret = test_no_shared_qgroup(root);
464 if (ret) 463 if (ret)