diff options
-rw-r--r-- | fs/btrfs/volumes.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 55c37276a29f..074c1c56d8c4 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -758,9 +758,13 @@ static noinline int find_free_dev_extent(struct btrfs_trans_handle *trans, | |||
758 | ret = btrfs_search_slot(trans, root, &key, path, 0, 0); | 758 | ret = btrfs_search_slot(trans, root, &key, path, 0, 0); |
759 | if (ret < 0) | 759 | if (ret < 0) |
760 | goto error; | 760 | goto error; |
761 | ret = btrfs_previous_item(root, path, 0, key.type); | 761 | if (ret > 0) { |
762 | if (ret < 0) | 762 | ret = btrfs_previous_item(root, path, key.objectid, key.type); |
763 | goto error; | 763 | if (ret < 0) |
764 | goto error; | ||
765 | if (ret > 0) | ||
766 | start_found = 1; | ||
767 | } | ||
764 | l = path->nodes[0]; | 768 | l = path->nodes[0]; |
765 | btrfs_item_key_to_cpu(l, &key, path->slots[0]); | 769 | btrfs_item_key_to_cpu(l, &key, path->slots[0]); |
766 | while (1) { | 770 | while (1) { |