diff options
| -rw-r--r-- | fs/btrfs/extent-tree.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 45d98d01028f..9c01509dd8ab 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -767,20 +767,19 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, | |||
| 767 | if (!path) | 767 | if (!path) |
| 768 | return -ENOMEM; | 768 | return -ENOMEM; |
| 769 | 769 | ||
| 770 | if (metadata) { | ||
| 771 | key.objectid = bytenr; | ||
| 772 | key.type = BTRFS_METADATA_ITEM_KEY; | ||
| 773 | key.offset = offset; | ||
| 774 | } else { | ||
| 775 | key.objectid = bytenr; | ||
| 776 | key.type = BTRFS_EXTENT_ITEM_KEY; | ||
| 777 | key.offset = offset; | ||
| 778 | } | ||
| 779 | |||
| 780 | if (!trans) { | 770 | if (!trans) { |
| 781 | path->skip_locking = 1; | 771 | path->skip_locking = 1; |
| 782 | path->search_commit_root = 1; | 772 | path->search_commit_root = 1; |
| 783 | } | 773 | } |
| 774 | |||
| 775 | search_again: | ||
| 776 | key.objectid = bytenr; | ||
| 777 | key.offset = offset; | ||
| 778 | if (metadata) | ||
| 779 | key.type = BTRFS_METADATA_ITEM_KEY; | ||
| 780 | else | ||
| 781 | key.type = BTRFS_EXTENT_ITEM_KEY; | ||
| 782 | |||
| 784 | again: | 783 | again: |
| 785 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, | 784 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, |
| 786 | &key, path, 0, 0); | 785 | &key, path, 0, 0); |
| @@ -788,7 +787,6 @@ again: | |||
| 788 | goto out_free; | 787 | goto out_free; |
| 789 | 788 | ||
| 790 | if (ret > 0 && metadata && key.type == BTRFS_METADATA_ITEM_KEY) { | 789 | if (ret > 0 && metadata && key.type == BTRFS_METADATA_ITEM_KEY) { |
| 791 | metadata = 0; | ||
| 792 | if (path->slots[0]) { | 790 | if (path->slots[0]) { |
| 793 | path->slots[0]--; | 791 | path->slots[0]--; |
| 794 | btrfs_item_key_to_cpu(path->nodes[0], &key, | 792 | btrfs_item_key_to_cpu(path->nodes[0], &key, |
| @@ -855,7 +853,7 @@ again: | |||
| 855 | mutex_lock(&head->mutex); | 853 | mutex_lock(&head->mutex); |
| 856 | mutex_unlock(&head->mutex); | 854 | mutex_unlock(&head->mutex); |
| 857 | btrfs_put_delayed_ref(&head->node); | 855 | btrfs_put_delayed_ref(&head->node); |
| 858 | goto again; | 856 | goto search_again; |
| 859 | } | 857 | } |
| 860 | if (head->extent_op && head->extent_op->update_flags) | 858 | if (head->extent_op && head->extent_op->update_flags) |
| 861 | extent_flags |= head->extent_op->flags_to_set; | 859 | extent_flags |= head->extent_op->flags_to_set; |
