diff options
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 4febca4fc2de..b3896d5f233a 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -691,6 +691,7 @@ struct backref_node *build_backref_tree(struct reloc_control *rc, | |||
691 | int cowonly; | 691 | int cowonly; |
692 | int ret; | 692 | int ret; |
693 | int err = 0; | 693 | int err = 0; |
694 | bool need_check = true; | ||
694 | 695 | ||
695 | path1 = btrfs_alloc_path(); | 696 | path1 = btrfs_alloc_path(); |
696 | path2 = btrfs_alloc_path(); | 697 | path2 = btrfs_alloc_path(); |
@@ -914,6 +915,7 @@ again: | |||
914 | cur->bytenr); | 915 | cur->bytenr); |
915 | 916 | ||
916 | lower = cur; | 917 | lower = cur; |
918 | need_check = true; | ||
917 | for (; level < BTRFS_MAX_LEVEL; level++) { | 919 | for (; level < BTRFS_MAX_LEVEL; level++) { |
918 | if (!path2->nodes[level]) { | 920 | if (!path2->nodes[level]) { |
919 | BUG_ON(btrfs_root_bytenr(&root->root_item) != | 921 | BUG_ON(btrfs_root_bytenr(&root->root_item) != |
@@ -957,14 +959,12 @@ again: | |||
957 | 959 | ||
958 | /* | 960 | /* |
959 | * add the block to pending list if we | 961 | * add the block to pending list if we |
960 | * need check its backrefs. only block | 962 | * need check its backrefs, we only do this once |
961 | * at 'cur->level + 1' is added to the | 963 | * while walking up a tree as we will catch |
962 | * tail of pending list. this guarantees | 964 | * anything else later on. |
963 | * we check backrefs from lower level | ||
964 | * blocks to upper level blocks. | ||
965 | */ | 965 | */ |
966 | if (!upper->checked && | 966 | if (!upper->checked && need_check) { |
967 | level == cur->level + 1) { | 967 | need_check = false; |
968 | list_add_tail(&edge->list[UPPER], | 968 | list_add_tail(&edge->list[UPPER], |
969 | &list); | 969 | &list); |
970 | } else | 970 | } else |