diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ioctl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 10c18a6582cc..3ca313b138ca 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -935,12 +935,14 @@ static int find_new_extents(struct btrfs_root *root, | |||
935 | min_key.type = BTRFS_EXTENT_DATA_KEY; | 935 | min_key.type = BTRFS_EXTENT_DATA_KEY; |
936 | min_key.offset = *off; | 936 | min_key.offset = *off; |
937 | 937 | ||
938 | path->keep_locks = 1; | ||
939 | |||
940 | while (1) { | 938 | while (1) { |
939 | path->keep_locks = 1; | ||
941 | ret = btrfs_search_forward(root, &min_key, path, newer_than); | 940 | ret = btrfs_search_forward(root, &min_key, path, newer_than); |
942 | if (ret != 0) | 941 | if (ret != 0) |
943 | goto none; | 942 | goto none; |
943 | path->keep_locks = 0; | ||
944 | btrfs_unlock_up_safe(path, 1); | ||
945 | process_slot: | ||
944 | if (min_key.objectid != ino) | 946 | if (min_key.objectid != ino) |
945 | goto none; | 947 | goto none; |
946 | if (min_key.type != BTRFS_EXTENT_DATA_KEY) | 948 | if (min_key.type != BTRFS_EXTENT_DATA_KEY) |
@@ -959,6 +961,12 @@ static int find_new_extents(struct btrfs_root *root, | |||
959 | return 0; | 961 | return 0; |
960 | } | 962 | } |
961 | 963 | ||
964 | path->slots[0]++; | ||
965 | if (path->slots[0] < btrfs_header_nritems(leaf)) { | ||
966 | btrfs_item_key_to_cpu(leaf, &min_key, path->slots[0]); | ||
967 | goto process_slot; | ||
968 | } | ||
969 | |||
962 | if (min_key.offset == (u64)-1) | 970 | if (min_key.offset == (u64)-1) |
963 | goto none; | 971 | goto none; |
964 | 972 | ||