aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorFeifei Xu <xufeifei@linux.vnet.ibm.com>2016-06-01 07:18:28 -0400
committerDavid Sterba <dsterba@suse.com>2016-06-06 11:17:12 -0400
commitef9f2db365c31433e52b0c5863793273bb632666 (patch)
tree9120d4e28c7e4aabc9b8cd69d86215cf4b8945e6 /fs
parentd94f43b4c6b88b9393422868d8dfde14c5923858 (diff)
Btrfs: self-tests: Use macros instead of constants and add missing newline
This commit replaces numerical constants with appropriate preprocessor macros. Reviewed-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c3
-rw-r--r--fs/btrfs/tests/extent-buffer-tests.c2
-rw-r--r--fs/btrfs/tests/qgroup-tests.c44
3 files changed, 31 insertions, 18 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 06ef433552b3..c3764ddb2a46 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1323,7 +1323,8 @@ struct btrfs_root *btrfs_alloc_dummy_root(u32 sectorsize, u32 nodesize)
1323 if (!root) 1323 if (!root)
1324 return ERR_PTR(-ENOMEM); 1324 return ERR_PTR(-ENOMEM);
1325 /* We don't use the stripesize in selftest, set it as sectorsize */ 1325 /* We don't use the stripesize in selftest, set it as sectorsize */
1326 __setup_root(nodesize, sectorsize, sectorsize, root, NULL, 1); 1326 __setup_root(nodesize, sectorsize, sectorsize, root, NULL,
1327 BTRFS_ROOT_TREE_OBJECTID);
1327 set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state); 1328 set_bit(BTRFS_ROOT_DUMMY_ROOT, &root->state);
1328 root->alloc_bytenr = 0; 1329 root->alloc_bytenr = 0;
1329 1330
diff --git a/fs/btrfs/tests/extent-buffer-tests.c b/fs/btrfs/tests/extent-buffer-tests.c
index 17b110f39f06..4f8cbd1ec5ee 100644
--- a/fs/btrfs/tests/extent-buffer-tests.c
+++ b/fs/btrfs/tests/extent-buffer-tests.c
@@ -225,6 +225,6 @@ out:
225 225
226int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize) 226int btrfs_test_extent_buffer_operations(u32 sectorsize, u32 nodesize)
227{ 227{
228 test_msg("Running extent buffer operation tests"); 228 test_msg("Running extent buffer operation tests\n");
229 return test_btrfs_split_item(sectorsize, nodesize); 229 return test_btrfs_split_item(sectorsize, nodesize);
230} 230}
diff --git a/fs/btrfs/tests/qgroup-tests.c b/fs/btrfs/tests/qgroup-tests.c
index 9c1d27352f19..57a12c0d680b 100644
--- a/fs/btrfs/tests/qgroup-tests.c
+++ b/fs/btrfs/tests/qgroup-tests.c
@@ -229,7 +229,7 @@ static int test_no_shared_qgroup(struct btrfs_root *root,
229 btrfs_init_dummy_trans(&trans); 229 btrfs_init_dummy_trans(&trans);
230 230
231 test_msg("Qgroup basic add\n"); 231 test_msg("Qgroup basic add\n");
232 ret = btrfs_create_qgroup(NULL, fs_info, 5); 232 ret = btrfs_create_qgroup(NULL, fs_info, BTRFS_FS_TREE_OBJECTID);
233 if (ret) { 233 if (ret) {
234 test_msg("Couldn't create a qgroup %d\n", ret); 234 test_msg("Couldn't create a qgroup %d\n", ret);
235 return ret; 235 return ret;
@@ -247,7 +247,8 @@ static int test_no_shared_qgroup(struct btrfs_root *root,
247 return ret; 247 return ret;
248 } 248 }
249 249
250 ret = insert_normal_tree_ref(root, nodesize, nodesize, 0, 5); 250 ret = insert_normal_tree_ref(root, nodesize, nodesize, 0,
251 BTRFS_FS_TREE_OBJECTID);
251 if (ret) 252 if (ret)
252 return ret; 253 return ret;
253 254
@@ -266,7 +267,8 @@ static int test_no_shared_qgroup(struct btrfs_root *root,
266 return ret; 267 return ret;
267 } 268 }
268 269
269 if (btrfs_verify_qgroup_counts(fs_info, 5, nodesize, nodesize)) { 270 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
271 nodesize, nodesize)) {
270 test_msg("Qgroup counts didn't match expected values\n"); 272 test_msg("Qgroup counts didn't match expected values\n");
271 return -EINVAL; 273 return -EINVAL;
272 } 274 }
@@ -299,7 +301,7 @@ static int test_no_shared_qgroup(struct btrfs_root *root,
299 return -EINVAL; 301 return -EINVAL;
300 } 302 }
301 303
302 if (btrfs_verify_qgroup_counts(fs_info, 5, 0, 0)) { 304 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID, 0, 0)) {
303 test_msg("Qgroup counts didn't match expected values\n"); 305 test_msg("Qgroup counts didn't match expected values\n");
304 return -EINVAL; 306 return -EINVAL;
305 } 307 }
@@ -325,8 +327,11 @@ static int test_multiple_refs(struct btrfs_root *root,
325 327
326 test_msg("Qgroup multiple refs test\n"); 328 test_msg("Qgroup multiple refs test\n");
327 329
328 /* We have 5 created already from the previous test */ 330 /*
329 ret = btrfs_create_qgroup(NULL, fs_info, 256); 331 * We have BTRFS_FS_TREE_OBJECTID created already from the
332 * previous test.
333 */
334 ret = btrfs_create_qgroup(NULL, fs_info, BTRFS_FIRST_FREE_OBJECTID);
330 if (ret) { 335 if (ret) {
331 test_msg("Couldn't create a qgroup %d\n", ret); 336 test_msg("Couldn't create a qgroup %d\n", ret);
332 return ret; 337 return ret;
@@ -339,7 +344,8 @@ static int test_multiple_refs(struct btrfs_root *root,
339 return ret; 344 return ret;
340 } 345 }
341 346
342 ret = insert_normal_tree_ref(root, nodesize, nodesize, 0, 5); 347 ret = insert_normal_tree_ref(root, nodesize, nodesize, 0,
348 BTRFS_FS_TREE_OBJECTID);
343 if (ret) 349 if (ret)
344 return ret; 350 return ret;
345 351
@@ -358,7 +364,7 @@ static int test_multiple_refs(struct btrfs_root *root,
358 return ret; 364 return ret;
359 } 365 }
360 366
361 if (btrfs_verify_qgroup_counts(fs_info, 5, 367 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
362 nodesize, nodesize)) { 368 nodesize, nodesize)) {
363 test_msg("Qgroup counts didn't match expected values\n"); 369 test_msg("Qgroup counts didn't match expected values\n");
364 return -EINVAL; 370 return -EINVAL;
@@ -371,7 +377,8 @@ static int test_multiple_refs(struct btrfs_root *root,
371 return ret; 377 return ret;
372 } 378 }
373 379
374 ret = add_tree_ref(root, nodesize, nodesize, 0, 256); 380 ret = add_tree_ref(root, nodesize, nodesize, 0,
381 BTRFS_FIRST_FREE_OBJECTID);
375 if (ret) 382 if (ret)
376 return ret; 383 return ret;
377 384
@@ -390,12 +397,14 @@ static int test_multiple_refs(struct btrfs_root *root,
390 return ret; 397 return ret;
391 } 398 }
392 399
393 if (btrfs_verify_qgroup_counts(fs_info, 5, nodesize, 0)) { 400 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
401 nodesize, 0)) {
394 test_msg("Qgroup counts didn't match expected values\n"); 402 test_msg("Qgroup counts didn't match expected values\n");
395 return -EINVAL; 403 return -EINVAL;
396 } 404 }
397 405
398 if (btrfs_verify_qgroup_counts(fs_info, 256, nodesize, 0)) { 406 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FIRST_FREE_OBJECTID,
407 nodesize, 0)) {
399 test_msg("Qgroup counts didn't match expected values\n"); 408 test_msg("Qgroup counts didn't match expected values\n");
400 return -EINVAL; 409 return -EINVAL;
401 } 410 }
@@ -407,7 +416,8 @@ static int test_multiple_refs(struct btrfs_root *root,
407 return ret; 416 return ret;
408 } 417 }
409 418
410 ret = remove_extent_ref(root, nodesize, nodesize, 0, 256); 419 ret = remove_extent_ref(root, nodesize, nodesize, 0,
420 BTRFS_FIRST_FREE_OBJECTID);
411 if (ret) 421 if (ret)
412 return ret; 422 return ret;
413 423
@@ -426,12 +436,14 @@ static int test_multiple_refs(struct btrfs_root *root,
426 return ret; 436 return ret;
427 } 437 }
428 438
429 if (btrfs_verify_qgroup_counts(fs_info, 256, 0, 0)) { 439 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FIRST_FREE_OBJECTID,
440 0, 0)) {
430 test_msg("Qgroup counts didn't match expected values\n"); 441 test_msg("Qgroup counts didn't match expected values\n");
431 return -EINVAL; 442 return -EINVAL;
432 } 443 }
433 444
434 if (btrfs_verify_qgroup_counts(fs_info, 5, nodesize, nodesize)) { 445 if (btrfs_verify_qgroup_counts(fs_info, BTRFS_FS_TREE_OBJECTID,
446 nodesize, nodesize)) {
435 test_msg("Qgroup counts didn't match expected values\n"); 447 test_msg("Qgroup counts didn't match expected values\n");
436 return -EINVAL; 448 return -EINVAL;
437 } 449 }
@@ -490,7 +502,7 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)
490 goto out; 502 goto out;
491 } 503 }
492 504
493 tmp_root->root_key.objectid = 5; 505 tmp_root->root_key.objectid = BTRFS_FS_TREE_OBJECTID;
494 root->fs_info->fs_root = tmp_root; 506 root->fs_info->fs_root = tmp_root;
495 ret = btrfs_insert_fs_root(root->fs_info, tmp_root); 507 ret = btrfs_insert_fs_root(root->fs_info, tmp_root);
496 if (ret) { 508 if (ret) {
@@ -505,7 +517,7 @@ int btrfs_test_qgroups(u32 sectorsize, u32 nodesize)
505 goto out; 517 goto out;
506 } 518 }
507 519
508 tmp_root->root_key.objectid = 256; 520 tmp_root->root_key.objectid = BTRFS_FIRST_FREE_OBJECTID;
509 ret = btrfs_insert_fs_root(root->fs_info, tmp_root); 521 ret = btrfs_insert_fs_root(root->fs_info, tmp_root);
510 if (ret) { 522 if (ret) {
511 test_msg("Couldn't insert fs root %d\n", ret); 523 test_msg("Couldn't insert fs root %d\n", ret);