diff options
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 7f92ab1daa87..65245a07275b 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -337,7 +337,7 @@ static void backref_tree_panic(struct rb_node *rb_node, int errno, u64 bytenr) | |||
337 | if (bnode->root) | 337 | if (bnode->root) |
338 | fs_info = bnode->root->fs_info; | 338 | fs_info = bnode->root->fs_info; |
339 | btrfs_panic(fs_info, errno, "Inconsistency in backref cache " | 339 | btrfs_panic(fs_info, errno, "Inconsistency in backref cache " |
340 | "found at offset %llu\n", bytenr); | 340 | "found at offset %llu", bytenr); |
341 | } | 341 | } |
342 | 342 | ||
343 | /* | 343 | /* |
@@ -528,7 +528,7 @@ static int should_ignore_root(struct btrfs_root *root) | |||
528 | { | 528 | { |
529 | struct btrfs_root *reloc_root; | 529 | struct btrfs_root *reloc_root; |
530 | 530 | ||
531 | if (!root->ref_cows) | 531 | if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) |
532 | return 0; | 532 | return 0; |
533 | 533 | ||
534 | reloc_root = root->reloc_root; | 534 | reloc_root = root->reloc_root; |
@@ -610,7 +610,7 @@ struct btrfs_root *find_tree_root(struct reloc_control *rc, | |||
610 | root = read_fs_root(rc->extent_root->fs_info, root_objectid); | 610 | root = read_fs_root(rc->extent_root->fs_info, root_objectid); |
611 | BUG_ON(IS_ERR(root)); | 611 | BUG_ON(IS_ERR(root)); |
612 | 612 | ||
613 | if (root->ref_cows && | 613 | if (test_bit(BTRFS_ROOT_REF_COWS, &root->state) && |
614 | generation != btrfs_root_generation(&root->root_item)) | 614 | generation != btrfs_root_generation(&root->root_item)) |
615 | return NULL; | 615 | return NULL; |
616 | 616 | ||
@@ -887,7 +887,7 @@ again: | |||
887 | goto out; | 887 | goto out; |
888 | } | 888 | } |
889 | 889 | ||
890 | if (!root->ref_cows) | 890 | if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) |
891 | cur->cowonly = 1; | 891 | cur->cowonly = 1; |
892 | 892 | ||
893 | if (btrfs_root_level(&root->root_item) == cur->level) { | 893 | if (btrfs_root_level(&root->root_item) == cur->level) { |
@@ -954,7 +954,8 @@ again: | |||
954 | upper->bytenr = eb->start; | 954 | upper->bytenr = eb->start; |
955 | upper->owner = btrfs_header_owner(eb); | 955 | upper->owner = btrfs_header_owner(eb); |
956 | upper->level = lower->level + 1; | 956 | upper->level = lower->level + 1; |
957 | if (!root->ref_cows) | 957 | if (!test_bit(BTRFS_ROOT_REF_COWS, |
958 | &root->state)) | ||
958 | upper->cowonly = 1; | 959 | upper->cowonly = 1; |
959 | 960 | ||
960 | /* | 961 | /* |
@@ -1258,7 +1259,7 @@ static int __must_check __add_reloc_root(struct btrfs_root *root) | |||
1258 | if (rb_node) { | 1259 | if (rb_node) { |
1259 | btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " | 1260 | btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " |
1260 | "for start=%llu while inserting into relocation " | 1261 | "for start=%llu while inserting into relocation " |
1261 | "tree\n", node->bytenr); | 1262 | "tree", node->bytenr); |
1262 | kfree(node); | 1263 | kfree(node); |
1263 | return -EEXIST; | 1264 | return -EEXIST; |
1264 | } | 1265 | } |
@@ -2441,7 +2442,7 @@ struct btrfs_root *select_reloc_root(struct btrfs_trans_handle *trans, | |||
2441 | next = walk_up_backref(next, edges, &index); | 2442 | next = walk_up_backref(next, edges, &index); |
2442 | root = next->root; | 2443 | root = next->root; |
2443 | BUG_ON(!root); | 2444 | BUG_ON(!root); |
2444 | BUG_ON(!root->ref_cows); | 2445 | BUG_ON(!test_bit(BTRFS_ROOT_REF_COWS, &root->state)); |
2445 | 2446 | ||
2446 | if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) { | 2447 | if (root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) { |
2447 | record_reloc_root_in_trans(trans, root); | 2448 | record_reloc_root_in_trans(trans, root); |
@@ -2506,7 +2507,7 @@ struct btrfs_root *select_one_root(struct btrfs_trans_handle *trans, | |||
2506 | BUG_ON(!root); | 2507 | BUG_ON(!root); |
2507 | 2508 | ||
2508 | /* no other choice for non-references counted tree */ | 2509 | /* no other choice for non-references counted tree */ |
2509 | if (!root->ref_cows) | 2510 | if (!test_bit(BTRFS_ROOT_REF_COWS, &root->state)) |
2510 | return root; | 2511 | return root; |
2511 | 2512 | ||
2512 | if (root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID) | 2513 | if (root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID) |
@@ -2893,14 +2894,14 @@ static int relocate_tree_block(struct btrfs_trans_handle *trans, | |||
2893 | goto out; | 2894 | goto out; |
2894 | } | 2895 | } |
2895 | 2896 | ||
2896 | if (!root || root->ref_cows) { | 2897 | if (!root || test_bit(BTRFS_ROOT_REF_COWS, &root->state)) { |
2897 | ret = reserve_metadata_space(trans, rc, node); | 2898 | ret = reserve_metadata_space(trans, rc, node); |
2898 | if (ret) | 2899 | if (ret) |
2899 | goto out; | 2900 | goto out; |
2900 | } | 2901 | } |
2901 | 2902 | ||
2902 | if (root) { | 2903 | if (root) { |
2903 | if (root->ref_cows) { | 2904 | if (test_bit(BTRFS_ROOT_REF_COWS, &root->state)) { |
2904 | BUG_ON(node->new_bytenr); | 2905 | BUG_ON(node->new_bytenr); |
2905 | BUG_ON(!list_empty(&node->list)); | 2906 | BUG_ON(!list_empty(&node->list)); |
2906 | btrfs_record_root_in_trans(trans, root); | 2907 | btrfs_record_root_in_trans(trans, root); |